How to redirect from port 80 on port 9000 with nginx

Hello everybody,

today I want to share with you how to make redirects with help of nginx. 

I have executed docker image of portainer in my linux environment on port 9000. 

And I need to make nginx to redirect incoming trafic from port 80 on port 9000. In order to achieve it I've made the following modifications in nginx.conf:

               

server {
               listen 80 default_server;
               listen [::]:80 default_server;
               server_name _;
               root /usr/share/nginx/html;

               # Load configuration files for the default server block.
               include /etc/nginx/default.d/*.conf;

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

               error_page 404 /404.html;
                              location = /40x.html {
               }

               error_page 500 502 503 504 /50x.html;
                              location = /50x.html {
                              }
           }

No Comments

Add a Comment