Wordpress/vBulletin/VBSEO rewrites

bradleyw nginx-forum at nginx.us
Fri Sep 17 05:01:50 MSD 2010

Hey guys,
Ok currently I have a blog and forum set up in this structure:

www.site.com > blog (Wordpress)
www.site.com/forums > forums (vBulletin)
However I wanted to use VBSEO with my forum, but it requires some
virtual host rewrites. This is my current virtual host file 
[quote]server {
    listen   80;
    server_name  site.com www.site.com;
    access_log  /var/log/nginx/localhost.access.log;

## Force WWW
    if ($host ~* ^site\.com) {
        rewrite ^(.*)$ http://www.site.com$1 permanent;

## Default location
    location / {
        root   /var/www;
        index  index.php;

## this sends all non-existing file or directory requests to index.php
        if (!-e $request_filename) {
            rewrite ^(.+)$ /index.php?q=$1 last;

## Images and static content is treated different
    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
      access_log        off;
      expires           30d;
      root /var/www;

## Parse all .php file in the /var/www directory
    location ~ .php$ {
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_pass   backend;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_param  QUERY_STRING     $query_string;
        fastcgi_param  REQUEST_METHOD   $request_method;
        fastcgi_param  CONTENT_TYPE     $content_type;
        fastcgi_param  CONTENT_LENGTH   $content_length;
        fastcgi_intercept_errors        on;
        fastcgi_ignore_client_abort     off;
        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 180;
        fastcgi_read_timeout 180;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;

## Disable viewing .htaccess & .htpassword
    location ~ /\.ht {
        deny  all;
upstream backend {

this is what vbseo gives to nginx customers to use 
location /forums/ {

rewrite ^/forums/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$
/forums/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;

if (!-e $request_filename) {
rewrite ^/forums/(.*)$ /forums/vbseo.php last;


if ($request_filename ~ "\.php$" ) {
rewrite ^/forums/(.*)$ /forums/vbseo.php last;

where exactly am I sticking that bit of code into my current virtual
host? DO I need to modify it as well to reflect the structure of my

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,131169,131169#msg-131169

More information about the nginx mailing list