Wordpress Multi-Site Converting Apache to Nginx

nrahl nginx-forum at nginx.us
Thu May 1 06:07:49 UTC 2014


Ok, at this point I have removed everything from the config just to try and
get the most basic thing working.

This is the entire config now:

location ^~ /wordpress/ {
   fastcgi_pass unix:/var/run/php5-fpm.sock;
}

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.

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

> Is your blank page a http 200 with no content, or a http 200 with some
> content that the browser shows as blank, or some other http response?

The blank page is a response code 200, with proper headers, but no body HTML
at all. View page source is empty.

> curl -v http://whatever/wp-admin/

Here is the output:

MyDomain is used in place of real domain.

* Adding handle: conn: 0x18f5b00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x18f5b00) send_pipe: 1, recv_pipe: 0
* About to connect() to www.MyDomain.com port 443 (#0)
*   Trying xx.xxx.xxx.xxx...
* Connected to www.MyDomain.com (xx.xxx.xxx.xxx) port 443 (#0)
> GET /wordpress/ HTTP/1.1
> User-Agent: curl/7.32.0
> Host: www.MyDomain.com
> Accept: */*
> 
< HTTP/1.1 200 OK
* Server nginx is not blacklisted
< Server: nginx
< Date: Thu, 01 May 2014 05:55:32 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: PHP/5.5.9-1ubuntu4
< 
* Connection #0 to host www.domain.com left intact



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

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,249743,249779#msg-249779



More information about the nginx mailing list