Are these rules ok?
shri at devlib.org
shri at devlib.org
Thu Dec 25 03:09:45 MSK 2008
Igor,
Thank you very much for taking the time to answer.
The setup is as follows.
/ <-- Wordpress is installed and shows the main page and content
/forum/ <-- vBulletin
/classifieds/ <-- Photopost
/scripts/ <-- perl CGI scripts
/resources/ <-- files built by the Gossamer Links CGI package
/resources/Detailed/ <-- More files built by the CGI package
I am using 0.7.24 which is the latest -devel branch I found in the Freebsd
ports.
Should I try a newer one?
Thanks once again for replying. Have fun on your vacation!
Regards,
Shri
On Wed, 24 Dec 2008 20:05:48 +0300, Igor Sysoev <is at rambler-co.ru> wrote:
> On Wed, Dec 24, 2008 at 11:32:46PM +0800, Shri @ GeoExpat.Com wrote:
>
>> 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.
>
> How do you separate wordpress, photopost classifieds, vbulletin, and
> gossamer
> on the site ? I see vbulletin's /forums, and some /scripts/
> and /resources/Detailed/ only.
>
> BTW, note that nginx does not support CGI.
>
> If you use 0.6.34, then it's better to apply patch
> http://sysoev.ru/nginx/patch.try_files.0.6.34
> and use new "try_files" directive.
> In 0.7.30 already has this functionality.
>
> Then you can handle Wordpress using following configuration:
>
> location / {
> try_files $uri @wordpress;
> }
>
> location ~ \.php$ {
> try_files $uri @wordpress;
>
> fastcgi_param SCRIPT_FILENAME /path/to$fastcgi_script_name;
> ... other fastcgi_param
> }
>
> location @wordpress {
> fastcgi_pass ...;
>
> fastcgi_param SCRIPT_FILENAME /path/to/index.php;
> ... other fastcgi_param
> }
>
> This is replacement of these Apache rules:
>
> #RewriteCond %{REQUEST_FILENAME} !-f
> #RewriteCond %{REQUEST_FILENAME} !-d
> #RewriteRule . /index.php [L]
>
>
>> ---------------------
>> 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;
>> }
>> }
>>
>> }
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
More information about the nginx
mailing list