I have just installed wordpress in a subdirectory of my domain: exaple.com/wordpress/
When I enter the url:
http://exaple.com/wordpress/
I am redirected to :
https://localhost/wordpress/
Apache2 is listening on port 8080 NGINX is listening on port 80, 443
I use NGINX as a reverse proxy, the configuration is the following:
server {
server_name example.com;
location / {
proxy_pass http://localhost:8080;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.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 = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name example.com;
listen 80;
return 404; # managed by Certbot
}
Apache configuration is:
<VirtualHost *:8080>
DocumentRoot "/var/www/example.com"
ServerName example.com
<Directory "/var/www/example.com">
Options MultiViews FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
TransferLog /var/log/apache2/nextcloud_access.log
ErrorLog /var/log/apache2/nextcloud_error.log
</VirtualHost>
In the WordPress database, table wp_options, I have already changed the two rows "siteurl" and "home" from:
http://localhost/wordpress/
to:
http://example.com/wordpress/
It is still not working.
proxy_set_header Host $http_host;just below theproxy_pass, otherwise, "upstream" will get the host name of the given URL (localhost...)