Error parsing wp-app.php (Wordpress) on Nginx

António P. P. Almeida appa at
Sun Jan 30 20:53:45 MSK 2011

On 30 Jan 2011 16h02 WET, nginx-forum at wrote:

> I moved my website from apache to nginx and everything seems to be
> working as expected except (Well, I've only seen that error) when I
> try to create posts through the Atom publishing protocol which can
> be accesed via, on apache it
> worked well but on nginx it gives me a 404 error, I think it's not
> only me because every other wordpress blog that is using nginx gives
> me that error.  I could only find this that could be semi-related to
> this error: but it is a
> fix for apache and I can't make it work on nginx Any ideas to fix
> it?  If you have a wordpress blog running on nginx I'd appreciate if
> you tell me if you can correctly access your wp-app.php file.  Note
> that I'm currently using php-cgi with nginx, Could php-fpm make it
> work?
> I've also setup a dumb installation for testing purposes at
> here is it's php information:
> with this nginx.conf file:
> I don't know if it's useful but here is
> the content of the wp-app.php file:

This doesn't make sense:
 if (!-e $request_filename) {
    rewrite ^(.*)$  /index.php last;

You're capturing the URI for what?

The Atom publishing works for me. I use a nested location and avoid
fastcgi_split_path_info. Following the suggestions of Igor and Maxim
on the list some time ago. Here's the PHP handling part.

        ## Regular PHP processing.
        location ~ ^(?<script>.+\.php)(?<path_info>.*)$ {
            include fastcgi.conf;
            ## The fastcgi_params must be redefined from the ones
            ## given in fastcgi.conf. No longer standard names
            ## but arbitrary: named patterns in regex.
            fastcgi_param SCRIPT_FILENAME $document_root$script;
            fastcgi_param SCRIPT_NAME $script;
            fastcgi_param PATH_INFO $path_info;
            ## Passing the request upstream to the FastCGI
            ## listener.
            fastcgi_pass unix:/tmp/php-cgi/php-cgi.socket;
            ## Upload progress support.
            track_uploads uploads 60s;

Note that this is just a snippet from the full config. There is also a
try_files directive:

    ## The 'final' attempt to serve the request.
    location @nocache {
        try_files $uri $uri/ /index.php?q=$uri&$args;

This config takes wp-super-cache in consideration. If you just want to
use WP then the config on the Wiki,
works (although using fastcgi_split_path_info). In case you're 
interested, my WP config is on github:

I've yet to include the multi-site setup.
--- appa

More information about the nginx mailing list