centos 7 下 nginx 添加防火墙端口号例外 不同端口号访问不同网站
不同端口号 对应不同的目录
找到nginx 配置文件
在sbin目录下的nginx 执行nginx -V(大写) 查看到配置文件
nginx 配置文件里 添加不同端口


基本代码如下:
server {
listen 8899;
server_name localhost;
location / {
root html/xiangcloudVersion201608;
index index.html index.htm index.php ;
}
}
这里还需要添加路由器里面的端口映射

然后把需要添加的端口添加到 firewall里面
查看firewall是否运行
firewall-cmd --state

启动firewall
systemctl start firewalld.service
停止firewall
systemctl stop firewalld.service
添加端口
firewall-cmd --permanent --add-port=8899/tcp

然后重启firewall
firewall-cmd --reload

上传更改完 需要重启nginx服务器

浙公网安备 33010602011771号