Welcome! Log In Create A New Profile

Advanced

nginx and WordPress in a subdirectory

August 06, 2013 01:40AM
Hello -

I've got nginx as a front-end to Apache and am trying to serve a single WordPress site from a location on my site. Right now I would like to test the location, but it will eventually be served as /advertise. I cannot get the WordPress site to serve correctly, however as I am seeing a 301 redirect infinite loop.

nginx location directive:

location ^~ /advertise-wp {
include /usr/local/nginx/proxypass.conf;
proxy_pass http://nsweb1.nstein.prod:90;
}

contents of /usr/local/nginx/proxypass.conf:
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Apache configuration:
Listen 90

<VirtualHost *:90>
ServerName www.sitename.com
ServerAlias nsweb1.nstein.prod

DocumentRoot /opt/nstein/advertise
ErrorLog /var/log/apache2/www_error.log
CustomLog /var/log/apache2/www_access.log combined
DirectoryIndex index.php

</VirtualHost>

<Directory "/opt/nstein/advertise">
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</Directory>

I have tried to make this work properly by setting these in wp-config.php as well, to no avail.
define('WP_HOME', 'http://www.sitename.com/advertise-wp');
define('WP_SITEURL', 'http://www.sitename.com/advertise-wp');

Thanks for your help.
SubjectAuthorPosted

nginx and WordPress in a subdirectory

daveyfxAugust 06, 2013 01:40AM

Re: nginx and WordPress in a subdirectory

mexAugust 06, 2013 02:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 62
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready