Wordpress Multi-Site Converting Apache to Nginx
Steve Holdoway
steve at greengecko.co.nz
Thu May 1 06:26:22 UTC 2014
Hi,
On Thu, 2014-05-01 at 02:07 -0400, nrahl wrote:
> 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?
>
With wordpress MU setups, you need to manually set up the blog id
( well, at least I have so far )... here's some extracts from one of my
site configs:
map $http_host $blogid {
default 0;
example.com.au 2;
example.com.tw 3;
}
location ~ ^/files/(.*)$ {
try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
}
and
location ^~ /blogs.dir {
internal;
alias /www/example.com/public_html/wp-content/blogs.dir ;
expires max;
}
If that still doesn't work, can you check that you've got everything
connected correctly by delivering a quick <?php phpinfo(); ?> file to
your browser?
There are example configs on the net - wordpress offers one for certain,
and googling for wordpress, mu and nginx deliver a plethora of howtos.
Why not begin with one of them and try to understand it, rather than
fighting to reinvent the wheel?
Steve
--
Steve Holdoway BSc(Hons) MIITP
http://www.greengecko.co.nz
Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa
More information about the nginx
mailing list