Skip to content

Instantly share code, notes, and snippets.

@edderrd
Last active December 29, 2016 18:36
Show Gist options
  • Save edderrd/04abe6209b35496e3c20c526f0b54460 to your computer and use it in GitHub Desktop.
Save edderrd/04abe6209b35496e3c20c526f0b54460 to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name VHOSTNAME;
root /var/www/$host/public;
index index.php;
error_log /var/log/nginx/VHOSTNAME.error.log;
access_log /var/log/nginx/VHOSTNAME.access.log;
charset utf-8;
gzip on;
gzip_vary on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/xml+rss;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
location ~ /\.ht {
deny all;
}
#location ~* \.(?:css|js)$ {
# expires 7d;
# access_log off;
# add_header Cache-Control "public";
#}
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|svg|woff|woff2|ttf)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment