1、关闭selinux、firewall
2、修改/etc/security/limits.conf添加以下内容:
* soft nofile 65536
* hard nofile 65536
3、修改/etc/security/limits.d/20-nproc.conf
* soft nproc 65536
4、重启系统,查看修改结果
ulimit -a
5、配置yum源/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgkey=http://nginx.org/keys/nginx_signing.key
gpgcheck=1
enabled=1
6、安装Nginx、修改Nginx配置文件/etc/nginx/nginx.conf
#安装Nginx
yum install -y nginx
#修改参数
worker_processes 2;
worker_connections 65536;
#添加以下内容
stream {
log_format basic '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time ' '$upstream_addr';
access_log /var/log/nginx/proxy.access.log basic;
upstream ssh_proxy {
hash $remote_addr consistent;
server 192.168.1.212:22;
server 192.168.1.213:22;
}
server {
listen 220;
proxy_connect_timeout 1s;
proxy_timeout 300s;
proxy_pass ssh_proxy;
}
}
7、启动Nginx测试
原文地址:http://blog.51cto.com/linux10000/2060071