server {
#port
listen 80;
server_name www.forum.website.com;
# rewrite www, try to keep your internal linking consistent.
rewrite ^ http://forum.website.com$request_uri? permanent;
error_log /var/log/nginx/website.log warn;
root /home/srv/www/website.com/public_html/forum;
#end changes needed to begin
location / {
#This sends everything through index.php and keeps the appended query string intact.
try_files $uri $uri/ /index.php?$uri&$args;
index index.html index.htm index.php;
#gzip it, gzip it good
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_min_length 1100;
gzip_buffers 64 8k;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
}
# use fastcgi for all php files
location ~ \.php$ {
# Zero-day exploit defense.
# http://forum.nginx.org/read.php?2,88845,page=3
try_files $uri /index.php =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#add some expires
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 1y;
log_not_found off;
}
#protect the innocent
location ~ ^/community/(internal_data|library)/(.*)$ {
internal;
}
# deny access to apache .htaccess files
location ~ /\.ht
{
deny all;
}
}