Are these rules ok?

Shri @ GeoExpat.Com shri at geoexpat.com
Wed Dec 24 18:32:46 MSK 2008


I'm trying to setup my first site, which uses wordpress, photopost classifieds, vbulletin and gossamer threads (CGI Perl based) software - along with some fairly simple posts.

The site is being migrated from apache (frontend) + lightttpd (static) to a nginx + fastcgi. I'm focused on migrating the PHP part first, as we can always proxy the CGI requests to Apache.

My nginx.conf looks like this (based on various bits and pieces found on google and mailing lists).

My questions are

1) Am I missing something obvious?
2) Why cant I get the Wordpress 404 to work correctly?
3) We need to exclude a couple of countries due to various illegal spam issues. Is this http://wiki.codemongers.com/NginxHttpGeoModule the best way to do it?

Thanks in advance from someone who is VERY new to Nginx. 

Regards,
Shri


---------------------
    server {

        listen  80;
        server_name domain.com www.domain.com;

        root /site/domain/dec08;

#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.php [L]

        error_page 404 =404 /index.php;

        index index.php index.html index.htm;

        location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {
                access_log      off;
                expires         30d;
                break;
        }

        ### Proxy CGI to Apache for now
        location ^~ /scripts/ {
              proxy_pass http://cgiserver;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header Host $host;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location ^~ /resources/Detailed/ {
              proxy_pass http://cgiserver;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header Host $host;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

#### Deal with VBSEO Rules
#RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
#RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron)
#RewriteRule ^((archive/)?(.*\.php(/.*)?)?)$ vbseo.php [L,QSA]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
#RewriteRule ^(.+)$ vbseo.php [L,QSA]

        location /forum/ {

        rewrite ^/forum/getnew.html$ /forum/search.php?do=getnew last;
        rewrite ^/forum/getnew([0-9]+).html$ /forum/search.php?do=getnew&f=$1 last;
        rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
        rewrite ^/forum/unanswered.html$ /forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1 last;
        rewrite ^/forum/unanswered([0-9]+).html$ /forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1 last;

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

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

        location ~ \.php {

                set $script $uri;
                set $path_info "";

#need this bit to work for classifieds friendly urls which need path_info to be set 

                if ($uri ~ "^(.+\.php)(/.+)") {
                        set $script $1;
                        set $path_info $2;
                }

            fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /site/expat/oct08$script;
            fastcgi_param  PATH_INFO    $path_info;
            include        fastcgi_params;
        }

        location ~ /\.ht {
            deny  all;
        }
    }

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20081224/b86a0eeb/attachment.html>


More information about the nginx mailing list