Skip to content

Instantly share code, notes, and snippets.

@un1ko85
un1ko85 / nginx.conf
Created November 10, 2016 07:43 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@un1ko85
un1ko85 / gist:a8198494409772da6243c90e7f0087fe
Created November 1, 2016 09:43 — forked from Mikodes/gist:be9b9ce42e46c3d4ccb6
All Media queries for resolutions
/* (320x480) iPhone (Original, 3G, 3GS) */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
/* insert styles here */
}
/* (320x480) Smartphone, Portrait */
@media only screen and (device-width: 320px) and (orientation: portrait) {
/* insert styles here */
}
@un1ko85
un1ko85 / sendy-server
Created June 2, 2016 11:19 — forked from refringe/sendy-server
Nginx configuration file example for Sendy (http://sendy.co/).
server {
listen 80;
listen [::]:80;
server_name domain.com;
autoindex off;
index index.php index.html;
root /srv/www/domain.com/public;
@un1ko85
un1ko85 / dabblet.css
Created May 26, 2016 09:00 — forked from jankorbel/dabblet.css
CSS animated loading dots
/*
CSS animated loading dots
*/
body
{
background: #5A5C64;
}
.loading_dots
@un1ko85
un1ko85 / deploy.sh
Created May 19, 2016 08:24
Letsencrypt FreeBSD deploy
#!/bin/sh
domain="example.net"
letsencryptdir="/usr/local/etc/letsencrypt.sh"
targets="mail http"
for jail in ${targets}; do
targetdir="/usr/jails/${jail}/etc/ssl"
# Check if the certificate has changed
[ -z "`diff -rq ${letsencryptdir}/certs/${domain}/fullchain.pem ${targetdir}/certs/${domain}.pem`" ] && continue
cp -L "${letsencryptdir}/certs/${domain}/privkey.pem" "${targetdir}/priv/${domain}.pem"
cp -L "${letsencryptdir}/certs/${domain}/fullchain.pem" "${targetdir}/certs/${domain}.pem"
@un1ko85
un1ko85 / FreeBSD_node_monit.md
Created January 19, 2016 08:03 — forked from fdelbos/FreeBSD_node_monit.md
FreeBSD 10 Nodejs setup with nginx, mongo and monit

FreeBSD 10 Nodejs setup with nginx, mongodb, redis and monit

This my receipe for installing a complete nodejs server on FreeBSD 10. The parameters used in this configuration are for a very small private server that I use for demo purpose only, so for a production server, you should somehow set the limits in pair with your ressources.

I use monit so I don't have to write rc scripts for node and it should take care of process lifecycle management for me. Alternatives exists such as supervisord or circus.

Installing mongodb

@un1ko85
un1ko85 / lets-encrypt-nginx.md
Created January 18, 2016 15:18 — forked from padde/lets-encrypt-nginx.md
Let's Encrypt with Nginx

Let's Encrypt with Nginx

Here's how I set up a tiny Nginx/Rails server that uses HTTPS via a Let's Encrypt issued certificate.

https://letsencrypt.paddd.de/

Server

I use the smallest DigitalOcean droplet (512 MB) here, which is built from the "Ubuntu Ruby on Rails on 14.04" image provided by them.

@un1ko85
un1ko85 / nginx
Last active January 18, 2016 15:16
nginx outdated browser detect
map $http_user_agent $outdated {
default 0;
"~MSIE [1-9]\." 1;
"~Mozilla.*Firefox/[1-9]\." 1;
"~Mozilla.*Firefox/[0-2][0-9]\." 1;
"~Mozilla.*Firefox/3[0-1]\." 1;
"~Opera.*Version/[0-9]\." 1;
"~Opera.*Version/[0-1][0-9]\." 1;
"~Opera.*Version/2[0-1]\." 1;
"~AppleWebKit.*Version/[0-6]\..*Safari" 1;
@un1ko85
un1ko85 / a.md
Created January 15, 2016 10:36 — forked from danharper/a.md
Laravel Queue Supervisor

Install Supervisor with sudo apt-get install supervisor. Ensure it's started with sudo service supervisor restart.

In /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread. And start using those changes with: sudo supervisorctl update.

@un1ko85
un1ko85 / nginx.conf
Created January 6, 2016 08:01
Rewrite URI with nginx and php-fpm. I have faced the problem that REQUEST_URI parameter is not changed on nginx rewrite rule. After some research I have found solution with replacing $request_uri variable.
server {
listen 80;
server_name site.dev;
index index.php;
root /Users/balkon_smoke/Sites/site.dev/web;
error_log /Users/balkon_smoke/Sites/site.dev/logs/error.log;
access_log /Users/balkon_smoke/Sites/site.dev/logs/access.log;
location / {