I am deploying a WordPress container to a VPS with CloudLinux, the problem is that I cannot remove the port from the URL therefore the WordPress installer shows me an error, I am using a reverse Apache proxy. I share the configuration:
On the other hand, I have a question, if that WordPress was already installed on the VPS, why is the installer opening? Assuming that files were copied from the directory to the container.
There is probably host url configuration in the workdpress config or in the database. Since it was long ago that I used Wordpress, someone on a Wordpress forum can give you a better answer probably regarding where you can find such a configuration.
I already checked the database and the URL is well defined. I think the problem is rather docker with Apache, thank you for taking the time to respond.
I see. Wouldnāt it be easier to put the rewrite rule to document root? At least just for testing if that works. Apache HTTPD configuration is also something I havenāt done recently, but I if I remember correctly, RewriteRule works differently when you try it in the Apache config. Iām not sure, it is possible that /dir matches the server root.
When I had these kind of problems I made a RewriteRule like this:
I tried but it stopped pointing at the container. Possibly you can change the .htaccess configuration rules but I donāt know a little about the subject.
It would be just copying that 3 lines to an .htaccess file in the documen root which is no as obvious when there is an .htaccess there already with other rules, but my singleline rule that I suggested for debugging was for using it in the app.conf.
Which VirtualHost is it for? (You need one for port 80, redirecting to HTTPS, and one for port 443)
You have mod_proxy routing /dir to http://domain:8088/ and mod_rewrite routing /dir to https://domain/dir ā only one of those is going to take effect, and in my experience mixing mod_proxy and mod_rewrite, itās never the one Iād expect!
I think your app.conf should be:
<VirtualHost *:80>
ServerName domain
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/dir(/.*)?$ https://domain/dir$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerName domain
ProxyPass /dir/ http://domain:8088/
ProxyPassReverse /dir/ http://domain:8088/
## Plus of course, your certificate definitions
</VirtualHost>
Also, do you really want http://domain:8088/? Now youāre routing onto the Internet, where I wouldnāt be wanting to expose port 8088. More likely, it should be http://localhost:8088/
Nowā¦ if your Apache is also containerized and in the same docker network, you could NOT expose the WP port at all, and make the ProxyPass statement ProxyPass /dir http://WP_CONTAINER_NAME/