为什么配置基于端口的虚拟主机不行,军哥帮忙看看?
本帖最后由 palit 于 2021-11-12 11:15 编辑CentoS7+lnmp
没有绑定域名,直接用内网 IP:port 访问;
看了自定义的端口和80都有监听,防火墙关了,SElinux 也关了!
80端口的页面OK,自定义配置的基于端口的虚拟主机都是超时,换端口也是一样;
虚拟主机conf
server
{
listen 内网的IP:8080;
#listen [::]:80;
server_name _;
index index.html index.htm index.php default.html default.htm default.php;
root/var/www;
include rewrite/none.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php-pathinfo.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log off;
}
# netstat-anp|grep 8080
tcp 0 0内网的IP:8080 0.0.0.0:* LISTEN
80端口OK, 8080 就超时,请问是哪里配置不对吗?
防火墙你关闭的iptables还是firewalld?
nginx改完是否重启生效,是否报错?
你这台服务器上直接 curl 127.0.0.1:8080 是否返回你设置的内容? 执行以下四个命令
systemctl stop iptables
systemctl stop firewalld
systemctl disable iptables
systemctl disable firewalld
很明显防火墙没关
页:
[1]