wget http://nginx.org/packages/centos/6/x86_64/RPMS/nginx-1.10.2-1.el6.ngx.x86_64.rpm
rpm -ivh nginx-1.10.2-1.el6.ngx.x86_64.rpm
或者
rpm -ivh http://nginx.org/packages/centos/6/x86_64/RPMS/nginx-1.10.2-1.el6.ngx.x86_64.rpm
启动:nginx -c /etc/nginx/nginx.conf
停止:nginx -s stop
查看端口是否被占用:lsof -i:80
lsof -i:443
杀死一个进程:kill -9 12774
防火墙配置:
vim /etc/sysconfig/ip6tables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
nginx代理WebSocket连接配置:
location = /ws {
proxy_pass http://127.0.0.1:5830;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}