Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinruscoe/505ceaa36ae9f570e75e069e983f68b5 to your computer and use it in GitHub Desktop.
Save kevinruscoe/505ceaa36ae9f570e75e069e983f68b5 to your computer and use it in GitHub Desktop.
Server Configs 2
# Include a redirect map, incase 301s are needed
# include /etc/nginx/conf.d/redirect-map.conf;
server {
listen 80;
server_name @@DOMAIN@@ www.@@DOMAIN@@;
root /var/www/vhosts/@@DOMAIN@@/public;
# Cache general assets for as long as possible
location ~* ^.+\.(ogg|ogv|eot|otf|woff|mp4|ttf|rss|atom|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|rtf)$ {
access_log off;
log_not_found off;
expires max;
}
# Cache images, css, js for 30 days
location ~* ^.+\.(css|js|jpeg|jpg|gif|png|svg|svgz|bmp|ico)$ {
access_log off;
log_not_found off;
expires 30d;
}
# Pass all requests to / to index.php
location / {
try_files $uri/ $uri /index.php?$args;
}
# Find a .php request and pass it php-fpm, using the users pool
index index.php index.html index.htm;
location ~ \.(php|html)$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_intercept_errors off;
fastcgi_pass unix:/run/php-fpm/DOMAIN.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# Pass all 50x errors to /var/www/vhosts/DOMAIN/errors/
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root /var/www/vhosts/DOMAIN/errors/;
# internal;
# }
# Redirect /old to /new, as defined in /etc/nginx/conf.d/redirect-map.conf
# if ($redirect_uri) {
# return 301 $redirect_uri;
# }
# Load everything inside /etc/nginx/default.d/
include /etc/nginx/default.d/*.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment