如何在同一个域名上设置两台服务器?

我有一个生产服务器,我已经做了一个重要的项目更新,所以我决定部署新的更新到一个单独的服务器,以testing它在同一个生产服务器上的另一个端口上,但它没有工作..

我试图设置端口9090指向我的testing服务器,但后来我得到:

http://example.com:9090/ This webpage is not available 

任何想法?

这是我的块:

testing服务器:

 server { listen 9090; server_name tree; root /home/forge/tree/public; # FORGE SSL (DO NOT REMOVE!) # ssl_certificate; # ssl_certificate_key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log off; error_log /var/log/nginx/tree-error.log error; error_page 404 /index.php; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; } } 

生产服务器:

 server { listen 80 default_server; server_name default; root /home/forge/default/public; # FORGE SSL (DO NOT REMOVE!) # ssl_certificate; # ssl_certificate_key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log off; error_log /var/log/nginx/default-error.log error; error_page 404 /index.php; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; } } 

错误是:

 2015/11/19 17:42:16 [error] 2878#0: *60 FastCGI sent in stderr: "PHP message: PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0" while reading response header from upstream, client: 46.185.165.167, server: default, request: "POST /api/get-country-tree?country_id=-1&level=3 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "kalimon.info", referrer: "http://kalimon.info/new_tree" 

编辑

 $ netstat -antp tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 18539/nginx: worker tcp 0 0 0.0.0.0:9090 0.0.0.0:* LISTEN 18539/nginx: worker $ wget localhost:9090 --2015-11-22 11:26:57-- http://localhost:9090/ Resolving localhost (localhost)... 127.0.0.1 Connecting to localhost (localhost)|127.0.0.1|:9090... connected. HTTP request sent, awaiting response... 403 Forbidden 2015-11-22 11:26:57 ERROR 403: Forbidden. 

编辑2

我通过以下方式解决了许可错误:

 $ chmod -R 775 ~/tree 

现在我得到答复… 200:

 $ wget 0.0.0.0:9090 --2015-11-22 12:17:47-- http://0.0.0.0:9090/ Connecting to 0.0.0.0:9090... connected. HTTP request sent, awaiting response... 200 OK 

但在浏览器中,我仍然收到错误ERR_CONNECTION_REFUSED

编辑3

好的,我正在接近答案:

 $ nmap localhost Starting Nmap 6.40 ( http://nmap.org ) at 2015-11-22 13:27 AST Nmap scan report for localhost (127.0.0.1) Host is up (0.00040s latency). Not shown: 995 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 9090/tcp open zeus-admin 3306/tcp open mysql 5432/tcp open postgresql 

所以,端口9090不使用端口80的HTTP服务,这是问题吗? 如何解决这个问题?

我尝试使用端口96,但它没有列出使用nmap本地主机时,我得到ERR_CONNECTION_TIMED_OUT

所以,我只能在本地连接,但使用浏览器时,我得到ERR_CONNECTION_TIMED_OUT如何正确打开端口?

感谢每个试图支持的人,解决scheme如下:

 sudo ufw allow [port number] 

我不知道我必须自己打开这个端口!

错误说403-禁止,确保Nginx的用户可以从你的webroot( /home/forge/tree/public )读取,如果启用了SELinux,你还必须添加这个端口来允许访问:

 semanage port -a -t http_port_t -p tcp 9090