Last active
February 26, 2018 07:45
-
-
Save mustardandrew/1be95db89fda9fc4d314da196116d41e to your computer and use it in GitHub Desktop.
Base configuration for nginx config
This file contains hidden or 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 { | |
server_name www.generator; | |
return 301 $scheme://generator$request_uri; | |
} | |
server { | |
listen 80; | |
listen [::]:80; | |
root /home/andrew/projects/generator/public; | |
index index.html index.php; | |
server_name generator; | |
charset utf-8; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location = /favicon.ico { access_log off; log_not_found off; } | |
location = /robots.txt { access_log off; log_not_found off; } | |
location ~ \.php$ { | |
try_files $uri = 404; | |
include fastcgi_params; | |
fastcgi_pass unix:/run/php/php7.1-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ { | |
expires 14d; | |
add_header Cache-Control "public"; | |
open_file_cache max=20000 inactive=20s; | |
open_file_cache_valid 30s; | |
} | |
gzip on; | |
gzip_proxied any; | |
gzip_comp_level 5; | |
gzip_types image/svg+xml text/plain text/xml application/xml application/javascript application/x-javascript text/jav$; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment