在Windows服务器上使用nginx,我想使用非域名来将流量定向到不同的端口,第一个可行,但是第二个却无法实现:为什么?怎么了? http://192.xxx.xxx.xxx/game:有效 http://192.xxx.xxx.xxx/cms:永远不会到达。 如果我更改名称,则cms正常工作,游戏将永远无法实现。
server {
listen 80;
server_name game;
location /{
proxy_pass http://localhost:4040;
proxy_connect_timeout 60s;
proxy_read_timeout 5400s;
proxy_send_timeout 5400s;
proxy_set_header host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect default;
}
location /uploads/ {
root c:\Ebrahimi\www\appGame;
}
}
server {
listen 80;
server_name cms;
location /{
proxy_pass http://localhost:2010;
proxy_connect_timeout 60s;
proxy_read_timeout 5400s;
proxy_send_timeout 5400s;
proxy_set_header host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect default;
}
location /uploads/ {
root c:\Ebrahimi\www\appCms;
}
}
提及“ Richard Smith”的新代码块:
server {
listen 80;
location /{
proxy_pass http://localhost:4040;
proxy_connect_timeout 60s;
proxy_read_timeout 5400s;
proxy_send_timeout 5400s;
proxy_set_header host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect default;
}
location /uploads/ {
root c:\Ebrahimi\www\appGame;
}
location /game {
proxy_pass http://localhost:4040;
}
location /cms{
proxy_pass http://localhost:2010;
}
}
答案 0 :(得分:1)
第二个<body>
<div class="wrapper">
<table class="toc" width="400">
<tbody>
<tr>
<td>1.1 Course Introduction</td>
<td><button class="playbutton" onclick="Section11()" type="button">
</button></td>
</tr>
<tr>
<td>1.2 Introduction to the Software</td>
<td><button class="playbutton" onclick="Section12()" type="button">
</button></td>
</tr>
</tbody>
</table>
<video id="myvideo" width="1160" height="100%" controls>
<source src="SW101.mp4" type="video/mp4">
</video>
</div>
</body>
<script>
var vid = document.getElementById("myvideo");
function Section11() {
vid.currentTime = 0;
vid.play();
}
function Section12() {
vid.currentTime = 312;
vid.play();
}
</script>
块只能使用其server
来访问,例如:server_name
如果使用服务器的IP地址访问服务器,则请求将由第一个http://app.firouzeh-mfg.ir/
块(或标记为server
的块)处理。有关详细信息,请参见this document。
您的两个URL default_server
和http://192.x.x.x/game
(假设IP地址相同)访问相同的http://192.x.x.x/cms
块,并且仅相差server
。
例如:
location