I’d like to host a WordPress site at http://example.com/content.

My main site is a Meteor site at example.com with nginx in front of it.

This is my nginx config file, but http://example.com/content is just being redirected to https://example.com/content and completely ignoring the /content location block. Any idea how to fix this?

# HTTP
server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html; # root is irrelevant
    index index.html index.htm; # this is also irrelevant

    server_name example.com;

    location /content/ {
        proxy_pass http://123.123.123.123; #wordpress ip
        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;
    }

    # redirect non-SSL to SSL
    location / {
        rewrite     ^ https://$server_name$request_uri? permanent;
    }
}

Read more here: Nginx redirect for one path (wordpress)


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: