<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Helvetica, Arial, sans-serif">Below is part
of a server block for a particular vhost:<br>
<br>
server {<br>
&nbsp;&nbsp;&nbsp; server_name mysite.tld ~^.+\.</font></font><font size="-1"><font
 face="Helvetica, Arial, sans-serif">mysite</font></font><font size="-1"><font
 face="Helvetica, Arial, sans-serif">\.tld$;<br>
<br>
&nbsp;&nbsp;&nbsp; set $base /var/www/</font></font><font size="-1"><font
 face="Helvetica, Arial, sans-serif">mysite;<br>
<br>
&nbsp;&nbsp;&nbsp; if ( $host ~* "^(x|y|z)\.</font></font><font size="-1"><font
 face="Helvetica, Arial, sans-serif">mysite\.tld$" ){<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; set $files misc;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; if ( $host ~* "^(admin)\.mysite\.tld$" ){<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; set $files admin;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
</font></font><font size="-1"><font face="Helvetica, Arial, sans-serif">&nbsp;&nbsp;&nbsp;
if ( $host = "mysite.tld" ){<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; set $files home;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; root $base/$files/www;<br>
&nbsp;&nbsp;&nbsp; error_page 404 $base/errors/404.html;<br>
<br>
&nbsp;&nbsp;&nbsp; location / {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; try_files $uri @webapp;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; location @webapp {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; rewrite ^/([\w\d]+)/([\w\d]+)(.*)? /index.php/$1/$2?_params=$3
last;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; location ~ \.php($|/) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; set $script $uri;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; set $path_info "";<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ($uri ~ "^(.+\.php)(/.+)") {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; set $script $1;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; set $path_info $2;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fastcgi_pass unix:/tmp/php-socket;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; include conf/fastcgi_params;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fastcgi_intercept_errors on;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fastcgi_param SCRIPT_FILENAME $base/$interface$script;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fastcgi_param PATH_INFO $path_info;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fastcgi_index index.php;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
}<br>
<br>
What I'm seeing in my error log is that the error_page its trying to
return is: </font></font><font size="-1"><font
 face="Helvetica, Arial, sans-serif">/var/www/</font></font><font
 size="-1"><font face="Helvetica, Arial, sans-serif">mysite</font></font><font
 size="-1"><font face="Helvetica, Arial, sans-serif">/var/www/</font></font><font
 size="-1"><font face="Helvetica, Arial, sans-serif">mysite/errors/404.html
instead of the expected </font></font><font size="-1"><font
 face="Helvetica, Arial, sans-serif">/var/www/</font></font><font
 size="-1"><font face="Helvetica, Arial, sans-serif">mysite/errors/404.html</font></font><br>
<font size="-1"><font face="Helvetica, Arial, sans-serif"><br>
I've also tried (with no success):<br>
<br>
error_page 404 @notfound;<br>
location @notfound {<br>
&nbsp;&nbsp;&nbsp; root $base/errors;<br>
&nbsp;&nbsp;&nbsp; error_page 404 404.html;<br>
&nbsp;&nbsp;&nbsp; index 404.html;<br>
}<br>
<br>
Here's my version information, if it helps:<br>
<br>
# nginx -V<br>
nginx version: nginx/0.7.55<br>
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-44)<br>
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid
--with-rtsig_module --with-select_module --with-poll_module
--with-http_ssl_module --with-http_stub_status_module
--with-http_gzip_static_module --with-http_flv_module
--with-http_random_index_module
--http-log-path=/var/log/nginx/access.log --with-md5=/usr/lib
--with-sha1=/usr/lib --without-mail_pop3_module
--without-mail_imap_module --without-mail_smtp_module
--add-module=nginx_circle_gif-0.1.3<br>
<br>
</font></font>
</body>
</html>