Wordpress Multi-Site Converting Apache to Nginx

Francis Daly francis at daoine.org
Thu May 1 06:55:48 UTC 2014

On Thu, May 01, 2014 at 02:07:49AM -0400, nrahl wrote:

Hi there,

> This is the entire config now:
> location ^~ /wordpress/ {
>    fastcgi_pass unix:/var/run/php5-fpm.sock;
> }

That says "talk fastcgi to that socket", but nothing useful is sent on
that connection because you have no fastcgi_param directives there. (And
no indication that any are inherited from the surrounding context.)

So php will not be asked to process any particular file.

You'll probably want SCRIPT_FILENAME, and possibly some more params,
to get any kind of useful output. The details depend on your fastcgi
server, but the nginx fastcgi.conf is usually a good starting point.

> location / {
>    return 403;
> }
> That's all the location blocks.
> What happens:
> 1. Going to any page that does not start with /wordpress/ produces a 403.
> This is correct according to my understating of the config.

Yes, that's what the config asks for.

> 2. Going to any url starting with /wordpress/ like /wordpress/wp-admin/ or
> even just /wordpress/ itself, produces a blank page. 

Yes, that's what the config asks for.

Strictly, it provides "whatever the fastcgi server returns"; but since
that is "nothing", that's what you get. The fastcgi server logs may have
more details.

> < X-Powered-By: PHP/5.5.9-1ubuntu4

So, nginx sent the request to the fastcgi server. That's good.

> > The logs will show which location is used. Can you see which
> > file-on-the-filesystem is returned?
> For the request /wordpress/ with above simple config, it matches the
> /wordpress/ location and passes it to fastcgi:

That's true of this config and test. The question was about the raw
wp-admin.php content that you reported with a previous config.

But it sounds like you're progressing with getting the config to do what
you want, so that's good.

> the log says: http upstream request: "/wordpress/?"
> then: http fastcgi record length: 61
> which seems a bit short. So PHP is returning nothing?

Correct. PHP processes the named input file, which you haven't set,
so it processes nothing and returns the output.

Francis Daly        francis at daoine.org

More information about the nginx mailing list