Skip to content

Instantly share code, notes, and snippets.

@ngfw
Created November 5, 2013 17:32
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 ngfw/7322873 to your computer and use it in GitHub Desktop.
Save ngfw/7322873 to your computer and use it in GitHub Desktop.
server {
server_name *.EXAMPLE.COM;
rewrite ^(.*) http://EXAMPLE.COM$1 permanent;
}
server {
listen 80;
server_name EXAMPLE.COM;
root /home/webserver/EXAMPLE.COM/Public;
access_log /var/log/nginx/EXAMPLE.COM_access.log main;
error_log /var/log/nginx/EXAMPLE.COM_error.log error;
location / {
root /home/webserver/EXAMPLE.COM/Public;
fastcgi_read_timeout 5m;
proxy_read_timeout 120;
index index.html index.php;
try_files $uri $uri/ /index.php;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /home/webserver/EXAMPLE.COM/Public;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}
location ~* \.php$ {
fastcgi_param PHP_VALUE "newrelic.appname=EXAMPLE.COM";
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
}
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment