0

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;
``
4
  • 1
    That looks fine. What exactly is your problem? Jun 23 at 8:55
  • @GeraldSchneider i mean port 8090 shouldn't be available to access from browser, it loading the website the as on the 80 i've changed ports.conf to "Listen 127.0.0.1:8090" for Apache. But in perfect conditions, when i accessing port 8090 in the browser, i have to be redirected to port 80 Jun 23 at 10:24
  • Have you tried this: serverfault.com/questions/174297/…
    – Ace
    Jun 23 at 10:34
  • 1
    I wouldn't bother about port 8090 more than binding it to the loopback interface. Jun 23 at 11:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.