Skip to content

Instantly share code, notes, and snippets.

@koenverburg
Created March 19, 2016 20:09
Show Gist options
  • Save koenverburg/1b2a79fa1aaa92390d50 to your computer and use it in GitHub Desktop.
Save koenverburg/1b2a79fa1aaa92390d50 to your computer and use it in GitHub Desktop.
nginx conf
upstream projects {
server 0.0.0.0:8000;
}
server {
listen 80 default_server;
#listen [::]:80 default_server ipv6only=on;
# SSL configuration
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
root /var/www/app/public;
# Add index.php to the list if you are using PHP
index index.php index.html;
server_name IP OR DOMAIN GOES HERE;
// uncommend this if your are using a lb
#location / {
# proxy_pass http://projects;
#}
// site that can be accets in the /var/www/app/public directory
// like a laravel or static site for example else commend it out
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
#try_files $uri $uri/ /index.php?$args;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
location ~ /\.ht {
deny all;
}
# cache css and js files
#location ~* \.(?:css|js)$ {
# expires 1y;
# access_log off;
# add_header Cache-Control "public";
#}
# Media: images, icons, vidoe, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment