0

I have nginx installed on ubuntu 20.4, and I need to set it up as reverse proxy to serve a webserver.

my webserver ip is 192.168.1.13 on port 8089 and I need it to be accessed from the public IP on a url for example webserver.mydomain.com.

my nginx.conf file looks like this:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  webserver.mydomain.com;

        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $backend;
                proxy_set_header X-NginX-Proxy true;
            proxy_pass http://192.168.1.13:8089/;
            index  index.html index.htm index.php;
            } # end location
        } # end server
    } # end http

is that correct or I have to do something else?

update: when I set hosts file for a local machine with the url and local nginx ip I can access the webserver. but still can't access it from internet ... port forwarded from IPS modem to nginx server ... when I change the forwarding to the webserver I can access it from internet. nginx firewall is disabled.

M Fadi
  • 1
  • 1

0 Answers0