server { listen 80; server_name YOURSITE.com *.YOURSITE.com; access_log logs/YOURSITE.access.log; location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ { root /home/YOURSITE/public_html; expires 30d; break; } location / { root /home/YOURSITE/public_html; index index.php; rewrite ^.*/files/(.*) /wp-content/blogs.php?file=$1; if (!-e $request_filename) { rewrite ^.+?(/wp-.*) $1 last; rewrite ^.+?(/.*\.php)$ $1 last; rewrite ^ /index.php last; } } location /forums/ { root /home/YOURSITE/public_html/forums; index index.php; if (!-e $request_filename) { rewrite ^/forums/topic/(.*)$ /forums/topic.php?q=$1 last; rewrite ^/forums/forum/(.*)$ /forums/forum.php?q=$1 last; rewrite ^/forums/profile/(.*)$ /forums/profile.php?q=$1 last; rewrite ^/forums/view/(.*)$ /forums/view.php?q=$1 last; rewrite ^/forums/tags/(.*)$ /forums/tags.php?q=$1 last; rewrite ^/forums/rss/(.*)$ /forums/rss.php?q=$1 last; rewrite ^/forums/bb-admin/ /forums/bb-admin/index.php last; rewrite ^/forums/ /forums/index.php last; break; } } error_page 500 502 503 504 /50x.html; location = /50x.html { root /home/YOURSITE/public_html; } error_page 400 402 403 404 /50x.html; location = /40x.html { root /home/YOURSITE/public_html; } location ~ \.php$ { fastcgi_pass 127.0.0.1:8087; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/YOURSITE/public_html$fastcgi_script_name; include /usr/local/nginx/conf/fastcgi_params; } } }