nginx manage local servers depends on income domain name

后端 未结 2 690
南方客
南方客 2020-12-18 13:18

I have a few applications that are running localy in defferents ports, how can I configure NGINX server for forwarding request from port 80 to my application depends on inco

2条回答
  •  自闭症患者
    2020-12-18 13:37

    I managed to do this easily by following this tutorial.

    Create a new file in /etc/nginx/conf.d/ called your-domain.com.conf and put this in it:

    server {
        listen 80;
        server_name your-domain.conf.com;
        location / {
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   Host      $http_host;
            proxy_pass         http://127.0.0.1:2368;
        }
    }
    

    Then restart nginx

    sudo service nginx restart

提交回复
热议问题