Created
January 25, 2016 04:00
-
-
Save gcphost/feeed6deb82709ed5995 to your computer and use it in GitHub Desktop.
Nginx default.conf for gzip and cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root /var/www/html/public; | |
index index.php index.html index.htm; | |
server_name localhost; | |
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 / { | |
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 ~* \.(?:css|js)$ { | |
expires 7d; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ \.php$ { | |
try_files $uri /index.php =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
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; | |
} | |
location ~ /\.ht { | |
deny all; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment