Linux下Nginx负载 iis问题

使用以下NGINX配置负载IIS

upstream 192.168.119.128{

    server 192.168.119.1:8081;

    server 192.168.119.1:8082;

}

 

server{

    listen   80;

    server_name  192.168.119.128;

    location /{

        proxy_pass   http://192.168.119.128;

    }

   

}

 

需要以下操作

  1. 关闭CentOS防火墙

 

虚拟机里nginx可以访问,但外部不能访问,解决方法:

vim /etc/sysconfig/iptables

添加

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

然后执行(即时生效,重启失效):

service iptables stop

service iptables start

 

重启后生效

chkconfig iptabels on

chkconfig iptabels off

 

  1. CentOS下查看SeLinux状态及关闭SeLinux

 

查看SELinux状态:

1、/usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态

SELinux status:                 enabled

2、getenforce                 ##也可以用这个命令检查

关闭SELinux:

1、临时关闭(不用重启机器):

setenforce 0                  ##设置SELinux 成为permissive模式

##setenforce 1 设置SELinux 成为enforcing模式

2、修改配置文件需要重启机器:

修改/etc/selinux/config 文件

将SELINUX=enforcing改为SELINUX=disabled

重启机器即可

 

安装 iptables-services

 

With RHEL 7 / CentOS 7, firewalld was introduced to manage iptables. IMHO, firewalld is more suited for workstations than for server environments.

It is possible to go back to a more classic iptables setup. First, stop and mask the firewalld service:
 

systemctl stop firewalld
systemctl mask firewalld

Then, install the iptables-services package:

yum install iptables-services

Enable the service at boot-time:

systemctl enable iptables

Managing the service

systemctl [stop|start|restart] iptables

Saving your firewall rules can be done as follows:

service iptables save

or

/usr/libexec/iptables/iptables.init save
posted @ 2017-01-05 22:04  kick  阅读(244)  评论(0编辑  收藏  举报