I have a website in a private subnet, which is working on apache 2.4 on port 8090 with reverse proxy to nginx 1.18 on port 80, meaning all static content operating nginx, and all dynamic - apache. I found that the website behaves like it's different websites on different web-servers. My point is to restrict access to 8090 and forward requests to 80. here's configs below: apache virtualhost
<VirtualHost 127.0.0.1>
ServerName gamingwiki.shprd.lan
ServerAlias www.gamingwiki.shprd.lan
ServerAdmin admin@gamingwiki.shprd.lan
DocumentRoot /opt/wiki
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
ports.conf
Listen 8090
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
nginx website.vhost
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name gamingwiki.shprd.lan;
#index doku.php index.html index.htm index.nginx-debian.html;
#forbid access to data,conf,bin,lib folders
location ~ /(data|conf|bin)/ {
deny all;
}
#forbid access to hidden files starts with .dot
location ~ /\. {
deny all;
#access_log off;
#log_not_found off;
}
# First attempt to serve requests as file, then as directory, then fall back to displaying a 404.
location / {
root /opt/wiki/;
proxy_pass http://127.0.0.1:8090/;
include /etc/nginx/proxy.conf;
#try_files $uri $uri/ =404;
}
}
and here's proxy.conf
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
``