在URL中,我看到类似http://example.com:8000/page
的内容。即使我设法通过键入不带端口的URL来访问该站点,但是当我转到任何子页面时,该URL都会添加到该站点。
我曾经有一个基于Python的Web服务器,而不是nginx,它运行良好,但是端口号却从来没有。这就是为什么我仍然希望有一种方法可以隐藏非标准端口(而不将其更改为标准端口),因为Python Web服务器未显示该端口。
顺便说一下,我将端口80 >> 8000重定向了。
nginx配置中是否有功能可从站点隐藏非标准端口?如果没有,也许还有其他方法?
我的配置:
server {
listen 8000;
access_log /logs/access.log;
error_log /logs/error.log;
index index.html;
server_name example.com;
error_page 404 errors/404.html;
location / {
try_files $uri $uri/ =404;
}
}
答案 0 :(得分:0)
我刚刚发现了
port_in_redirect off;
解决它。