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
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
Great, root and admin panel work... but every other page returns a 404 error by OpenLiteSpeed.
Here's my `nginx` conf file.
OpenLiteSpeed running in Docker on port 5080 has automatic default configuration, that's the bottom of the configuration file
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.
I'm thinking the problem is with OpenLiteSpeed configuration because Nginx forwards the request and OpenLiteSpeed is the one throwing the 404 error.
I'm hosting the blog in '/blog' sub-path here.
I added this to wp-config.php
Code:
define('WP_HOME', 'https://www.shamanicattraction.com/blog/');
define('WP_SITEURL', 'https://www.shamanicattraction.com/blog/');
The deployment finally works. Figured out I could fix the admin panel by adding this in wp-config.php
Code:
$_SERVER['REQUEST_URI'] = str_replace("/wp-admin/", "/blog/wp-admin/", $_SERVER['REQUEST_URI']);
Here's my `nginx` conf file.
Code:
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
}
Code:
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'm thinking the problem is with OpenLiteSpeed configuration because Nginx forwards the request and OpenLiteSpeed is the one throwing the 404 error.