I am migrating my wordpress site from Ispconfig/Apache to Ispconfig/Nginx and introducing Nginx proxy manager in the mix. The problem seems to be the following:
- htaccess is not enabled in nginx
- are the php directs working ?
I am using ispconfig server with Nginx A site is enable on ispconfig listening on port 801 The site is installed with wordpress using php-fpm7.4
On that same server i am using Nginx proxy manager in a docker container.
With some adjustment to the wp-config.php i am able to have a functional wordpress site using default permalinks. The config added to wp-config.php is:
define('FORCE_SSL_ADMIN', true);
if( strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false )
$_SERVER['HTTPS'] = 'on';
else
$_SERVER['HTTPS'] = 'off';
define('WP_HOME','https://www.example.com');
define('WP_SITEURL','https://www.example.com');
So far so good. My site is functioning with urls like https://example.com/?page_id=503
My goals is my site to be functioning like: https://example.com/offerings
What i have tried (alot but i ll try to list most):
Changing the config in nginx proxy manage config for my site by adding: Since the proxy manager does not have direct access to the php file socket i mounted the /var/run/php/ to /var/run2 in the container
location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include fastcgi.conf; fastcgi_pass unix:/var/run2/php7.4-fpm.sock;
convert php-fpm7.4 service to listen on tcp instead of file socket
When i activate this config i only see in the access log:
[01/Jun/2024:23:14:07 +0000] - 404 404 - GET https www.example.com "/blog/" [Client 172.18.0.1]
[Length 858] [Gzip -] [Sent-to example.com] "Mozilla/5.0 (Windows NT 10.0; Win64; x64;
rv:126.0) Gecko/20100101 Firefox/126.0" "https://www.example.com/"
[01/Jun/2024:23:14:07 +0000] - - 499 - GET https www.example.com "/favicon.ico" [Client
172.18.0.1] [Length 0] [Gzip -] [Sent-to example.com] "Mozilla/5.0 (Windows NT 10.0; Win64;
x64; rv:126.0) Gecko/20100101 Firefox/126.0" "https://www.example.com/blog/"
I have also tried to convert my htaccess file to nginx with online converters and corporate this into my nginx proxy manager config
Default config: proxy config in NPM:
# ------------------------------------------------------------
# www.example.com
# ------------------------------------------------------------
server {
set $forward_scheme http;
set $server "EXAMPLE.COM";
set $port 801;
listen 80;
#listen [::]:80;
listen 443 ssl http2;
#listen [::]:443;
server_name www.EXAMPLE.COM;
# Let's Encrypt SSL
include conf.d/include/letsencrypt-acme-challenge.conf;
include conf.d/include/ssl-ciphers.conf;
ssl_certificate /etc/letsencrypt/live/npm-24/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/npm-24/privkey.pem;
access_log /data/logs/proxy-host-15_access.log proxy;
error_log /data/logs/proxy-host-15_error.log warn;
location / {
# Proxy!
include conf.d/include/proxy.conf;
}
# Custom
include /data/nginx/custom/server_proxy[.]conf;
}