Wordpress Multi-Site Converting Apache to Nginx

Nick Rahl nrahl at aquagear.com
Wed Apr 30 03:33:57 UTC 2014


Side Note: It appears the forum is down.http://forum.nginx.org  says, "The database connection failed. Please check your database configuration
  in include/db/config.php. If the configuration is okay, check if the database server is running."


> That's not what ^~ means.

The manual says, "If the longest matching prefix location has the "|^~|" 
modifier then regular expressions are not checked". Which means that a 
^~ location will have a higher priority than a regular expression rule, 
right?


> What request do you make?
> Which one of the above locations does the request match?
> What output do you expect?
> What output do you get?


First rule:

location ^~ /wordpress/ {
    try_files $uri /wordpress/index.php =404;
}

What I intend: "If the URL starts with "/wordpress/", then do not check 
any regular expression rules. Instead, load the requested URI directly."
What happens: when visiting "wordpress/" I get a blank page.
The Log:
2014/04/30 02:39:06 [debug] 27354#0: post event 00007F68E8FD9010
2014/04/30 02:39:06 [debug] 27354#0: delete posted event 00007F68E8FD9010
2014/04/30 02:39:06 [debug] 27354#0: accept on 0.0.0.0:80, ready: 1
2014/04/30 02:39:06 [debug] 27354#0: posix_memalign: 
0000000000E79F90:256 @16
2014/04/30 02:39:06 [debug] 27354#0: *5 accept: [REMOVED MY IP] fd:9
2014/04/30 02:39:06 [debug] 27354#0: *5 event timer add: 9: 
20000:1398825566351
2014/04/30 02:39:06 [debug] 27354#0: *5 reusable connection: 1
2014/04/30 02:39:06 [debug] 27354#0: *5 epoll add event: fd:9 op:1 
ev:80000001
2014/04/30 02:39:06 [debug] 27354#0: accept() not ready (11: Resource 
temporarily unavailable)

That's it, no error.


Second Problem Rule:

I have updated this rule to be a regex rule:

llocation ~ ^/(wp-(content|admin|includes).*) {
       try_files /wordpress/$1 /wordpress/$1/index.php =404;
    }


What I intend: "If /wp-content followed by anything, or /wp-admin 
followed by anything, or /wp-includes followed by anything: Silently (no 
browser redirect) show the same URL as if a /wordpress/ directory were 
inserted in front. ie. "/wp-admin/bob" becomes 
"/wordpress/wp-admin/bob/", but does not do a redirect. If a directory, 
load index.php inside the given directoy."
What happens: I visit /wp-admin/ and get wp-admin.php, dumped as plain text.

It's not passing to PHP.

But I have a PHP block:

location ~ \.php$ {
       try_files $uri =404;
       fastcgi_split_path_info ^(.+\.php)(/.+)$;
       fastcgi_index index.php;
       include fastcgi_params;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       fastcgi_pass unix:/var/run/php5-fpm.sock;
}

So it should be passing to PHP?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140429/aa9d23c0/attachment-0001.html>


More information about the nginx mailing list