How to configure nginx.org as proxy server for aqueduct server?

476 views Asked by At

My aqueduct server is working on ubuntu 18.04 (http://127.0.0.1:8888). I install nginx from nginx.org. Currently I don't use any block for my aqueduct on nginx. I modified default config such as I add my domain name into it. And separately both my aqueduct server and nginx server is working.

My problem is that how to configure my nginx so I can use reverse proxy option so I don't connect to my aqueduct server directly. Any help please?

PS. I use fake domain and ip to show my config settings.

my nginx config is:

# Default server configuration
# My domain (mobile.niyazitoros.com) ip: 5.5.5.5 // TEST IP
# ------ http://mobile.niyazitoros.com  and http://5.5.5.5  is working.

server {
    listen 80 default_server;
    listen [::]:80 default_server;

       server_name mobile.niyazitoros.com;

#    root /var/www/example.com;
#    index index.html;

    location / {
# My aqueduct server works on 127.0.0.1:8888
               proxy_pass http://127.0.0.1:8888/;
    }
}
1

There are 1 answers

0
Nick On BEST ANSWER

Ok. I found it. to I use default.conf in sites-available and sites-enabled. this was wrong place to modify default.conf. Correct path is modify default.conf in conf.d dir.

1) install nginx 2) run: nginx -v
(nginx version: nginx/1.15.5) 3) sudo nano /etc/nginx/conf.d/default.conf

server {
    listen 80;
        listen [::]:80;

        error_log    /var/log/nginx/your_domain_name.error.log debug;
        rewrite_log on;

        server_name your_domain_name;

        location / {
                proxy_pass http://127.0.0.1:8888/;
    }
}

4) sudo systemctl reload nginx 5) sudo systemctl restart nginx 6) sudo nginx -t 7) curl http://your_domain_name/