2014-06-05, 13:53:08
I'm trying to set up GS on an nginx server, where GS is not in the root directory of the site but only handles a subdirectory (example.com/publications). Rewrites aren't working as expected.
My nginx config:
The "php_params" file is a shortcut I use that handles all the fastcgi stuff. (I host several other sites, including some Wordpress ones where we've converted the .htaccess to nginx configs, and they all work just fine, so I'm quite sure the "php_params" isn't the issue.)
With the above config, what happens is this:
I have Use Fancy URLs enabled in the General Settings, and the Permalink Structure is "%parent%/%slug%/" (although the input field is disabled and I can't edit it).
Any idea where I messed up?
My nginx config:
Code:
index index.php index.html;
location /publications/
{
try_files $uri $uri/ /publications/index.php?id=$uri&$args;
}
location ~* /publications/admin/.*\.php$
{
try_files $uri /publications/admin/index.php?id=$uri&$args;
include php_params;
}
location ~* \.php$
{
try_files $uri =404;
include php_params;
}
The "php_params" file is a shortcut I use that handles all the fastcgi stuff. (I host several other sites, including some Wordpress ones where we've converted the .htaccess to nginx configs, and they all work just fine, so I'm quite sure the "php_params" isn't the issue.)
With the above config, what happens is this:
- example.com/publications force downloads the GS index.php (i.e. it isn't interpreted by PHP)
- example.com/publications/ force downloads as well
- example.com/publications/index.php works and loads the page I set up in GS as the index
- example.com/publications/test-page loads a GS-formatted 404 page
- example.com/publications/test-page/ loads a GS-formatted 404 page, except without any CSS files (since the URLs for the stylesheets are now "publications/style.css" instead of "style.css")
- example.com/publications/index.php?id=test-page works as expected
I have Use Fancy URLs enabled in the General Settings, and the Permalink Structure is "%parent%/%slug%/" (although the input field is disabled and I can't edit it).
Any idea where I messed up?