<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16788" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>My nginx.conf looks like this (based on various
bits and pieces found on google and mailing lists).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>My questions are</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>1) Am I missing something obvious?</FONT></DIV>
<DIV><FONT face=Arial size=2>2) Why cant I get the Wordpress 404 to work
correctly?</FONT></DIV>
<DIV><FONT face=Arial size=2>3) We need to exclude a couple of countries due to
various illegal spam issues. Is this <A
href="http://wiki.codemongers.com/NginxHttpGeoModule">http://wiki.codemongers.com/NginxHttpGeoModule</A> the
best way to do it?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Thanks in advance from someone who is VERY new to
Nginx. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
<DIV><FONT face=Arial size=2>Shri</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>---------------------</FONT></DIV>
<DIV><FONT face=Arial size=2> server {</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
listen 80;<BR> server_name
domain.com <A href="http://www.domain.com">www.domain.com</A>;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> root
/site/domain/dec08;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#RewriteCond %{REQUEST_FILENAME}
!-f<BR>#RewriteCond %{REQUEST_FILENAME} !-d<BR>#RewriteRule . /index.php
[L]</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
error_page 404 =404 /index.php;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> index
index.php index.html index.htm;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> location
~* \.(jpg|jpeg|gif|css|png|js|ico)$
{<BR>
access_log
off;<BR>
expires
30d;<BR>
break;<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> ###
Proxy CGI to Apache for now</FONT></DIV>
<DIV><FONT face=Arial size=2> location
^~ /scripts/
{<BR>
proxy_pass <A
href="http://cgiserver">http://cgiserver</A>;<BR>
proxy_set_header X-Real-IP
$remote_addr;<BR>
proxy_set_header Host
$host;<BR>
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;<BR>
}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> location
^~ /resources/Detailed/
{<BR>
proxy_pass <A
href="http://cgiserver">http://cgiserver</A>;<BR>
proxy_set_header X-Real-IP
$remote_addr;<BR>
proxy_set_header Host
$host;<BR>
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;<BR>
}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#### Deal with VBSEO Rules</FONT></DIV>
<DIV><FONT face=Arial size=2>#RewriteRule
^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$
vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]<BR>#RewriteCond %{REQUEST_URI}
!(admincp/|modcp/|cron)<BR>#RewriteRule ^((archive/)?(.*\.php(/.*)?)?)$
vbseo.php [L,QSA]<BR>#RewriteCond %{REQUEST_FILENAME} !-f<BR>#RewriteCond
%{REQUEST_FILENAME} !-d<BR>#RewriteCond %{REQUEST_FILENAME}
!^(admincp|modcp|clientscript|cpstyles|images)/<BR>#RewriteRule ^(.+)$ vbseo.php
[L,QSA]<BR></FONT></DIV>
<DIV><FONT face=Arial size=2> location
/forum/ {</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> rewrite
^/forum/getnew.html$ /forum/search.php?do=getnew
last;<BR> rewrite
^/forum/getnew([0-9]+).html$ /forum/search.php?do=getnew&f=$1
last;<BR> rewrite
^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$
/forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1
last;<BR> rewrite
^/forum/unanswered.html$
/forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1
last;<BR> rewrite
^/forum/unanswered([0-9]+).html$
/forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1
last;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> if
($request_filename ~ "\.php$" )
{<BR>
rewrite ^/forum/(.*)$ /forum/vbseo.php
last;<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> if (!-e
$request_filename)
{<BR>
rewrite ^/forum/(.*)$ /forum/vbseo.php
last;<BR>
}<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> location
~ \.php {</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>
set $script
$uri;<BR>
set $path_info "";</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#need this bit to work for classifieds friendly
urls which need path_info to be set </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>
if ($uri ~ "^(.+\.php)(/.+)")
{<BR>
set $script
$1;<BR>
set $path_info
$2;<BR>
}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>
fastcgi_pass
unix:/var/tmp/lighttpd/fastcgi-php.sock;<BR>
fastcgi_index
index.php;<BR>
fastcgi_param SCRIPT_FILENAME
/site/expat/oct08$script;<BR>
fastcgi_param PATH_INFO
$path_info;<BR>
include
fastcgi_params;<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> location
~ /\.ht {<BR>
deny all;<BR>
}<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>