2017-10-02 18 views
0

私はexample.com仮想ホスト用のポートで静的なHTMLページを提供するnginxサーバを持っています。nginx仮想ホスト、httpサーバ、およびtcpポートへの転送

私は道

example.com   --->  /var/www/servers/example.com/ 
example.com:50001 --->  localhost:50001 
example.com:50002 --->  localhost:50002 

どのように私はこれを達成することができますが、以下にexample.comにすべての要求を転送したいlocalhost:50001localhost:50002

上で実行されている2台の以上のサーバーがありますか?

私は最初のものを達成することができるよ、と50001に聴き始めと50002

ここでは、私は、リバースプロキシは何が必要だと思う設定

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

     listen 50001; 
     listen [::]:50001; 

     listen 50002; 
     listen [::]:50002; 

     root /var/www/servers/example.com/; 

     index index.php index.html index.htm index.nginx-debian.html; 

     server_name example.com; 

     location/{ 
       try_files $uri $uri/ =404; 
     } 


     location ~ \.php$ { 
       include snippets/fastcgi-php.conf; 

       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; 

     } 

     location ~ /\.ht { 
       deny all; 
     } 
} 

答えて

関連する問題