VPS侦探论坛

 找回密码
 注册
查看: 5885|回复: 2

为什么配置基于端口的虚拟主机不行,军哥帮忙看看?

[复制链接]
发表于 2021-11-12 11:07:37 | 显示全部楼层 |阅读模式

本帖最后由 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;
    }



[root@pilot ~]# netstat  -anp  |grep 8080
tcp        0      0  内网的IP:8080      0.0.0.0:*               LISTEN

80端口OK, 8080 就超时,请问是哪里配置不对吗?






美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2021-11-12 19:34:23 | 显示全部楼层


防火墙你关闭的iptables还是firewalld?
nginx改完是否重启生效,是否报错?
你这台服务器上直接 curl 127.0.0.1:8080 是否返回你设置的内容?
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2022-12-4 19:31:27 | 显示全部楼层

执行以下四个命令
          systemctl stop iptables  
          systemctl stop firewalld
          systemctl disable iptables
          systemctl disable firewalld
很明显防火墙没关
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-7-27 08:32 , Processed in 0.037187 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表