0

I installed WordPress+OpenLiteSpeed in Docker using this script, adapting it for my needs.

I'm hosting the blog in /blog sub-path here.

I added this to wp-config.php

define('WP_HOME', 'https://www.shamanicattraction.com/blog/');
define('WP_SITEURL', 'https://www.shamanicattraction.com/blog/');

Home page works! Admin panel redirects to root.

The deployment finally works. Figured out I could fix the admin panel by adding this in wp-config.php

$_SERVER['REQUEST_URI'] = str_replace("/wp-admin/", "/blog/wp-admin/",  $_SERVER['REQUEST_URI']);

Great, root and admin panel work... but every other page returns a 404 error by OpenLiteSpeed.

Here's my nginx conf file.

server {
    listen        80;
    listen        [::]:80;
    server_name   shamanicattraction.com;
    return 301 $scheme://www.shamanicattraction.com$request_uri;

    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/www.shamanicattraction.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/www.shamanicattraction.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    server_name   www.shamanicattraction.com;

    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
    }

    location / {
        proxy_pass         http://127.0.0.1:5004/;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection $connection_upgrade;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }

    location /blog/ {
    proxy_pass         http://127.0.0.1:5080/;
        proxy_set_header   Host $host;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }

    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/www.shamanicattraction.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/www.shamanicattraction.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = www.shamanicattraction.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen        80;
    listen        [::]:80;
    server_name   www.shamanicattraction.com;
    return 404; # managed by Certbot
}

OpenLiteSpeed running in Docker on port 5080 has automatic default configuration, that's the bottom of the configuration file

vhTemplate docker {
    templateFile            conf/templates/docker.conf
    listeners               HTTP, HTTPS
    member shamanicattraction.com {
        vhDomain              shamanicattraction.com,www.shamanicattraction.com
    }
    note                    docker

    member localhost {
        vhDomain              localhost, *
    }
}

I can't figure this one out. Why does it keep redirecting to root and breaking the URLs? In Wordpress, General and Permalink tabs look OK.

0

You must log in to answer this question.

Browse other questions tagged .