标签:
yum install openssl*
cd /usr/local/src/
wget http://ncu.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz
tar -zxf pcre-8.32.tar.gz
cd pcre-8.32
./configure --prefix=/usr/local/pcre-8.32
make && make install
yum -y install gd gd2 gd-devel gd2-devel
cd /usr.local/src/
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
wget http://nginx.org/download/nginx-1.7.0.tar.gz
tar -zxf nginx-1.7.0.tar.gz
cd nginx-1.7.0
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.32 --with-http_realip_module --with-http_image_filter_module
make && make install
启动Nginx
ulimit -SHn 65535
/usr/local/webserver/nginx/sbin/nginx
配置开机自动启动Nginx + PHP
vi /etc/rc.local
在末尾增加以下内容:
ulimit -SHn 65535
/usr/local/webserver/php/sbin/php-fpm start
/usr/local/webserver/nginx/sbin/nginx
优化Linux内核参数
vi /etc/sysctl.conf
在末尾增加以下内容:
# Add
net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog = 32768
net.core.somaxconn = 32768
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_tw_recycle = 1
#net.ipv4.tcp_tw_len = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800
#net.ipv4.tcp_fin_timeout = 30
#net.ipv4.tcp_keepalive_time = 120
net.ipv4.ip_local_port_range = 1024 65535
使配置立即生效:
/sbin/sysctl -p
添加nginx 软连接
ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx
nginx -t 测试配置文件
nginx -s reload 平滑重启
kill -USR2 `cat /usr/local/nginx/logs/nginx.pid` 重启
kill -INT `cat /usr/local/nginx/logs/nginx.pid` 停止
标签:
原文地址:http://www.cnblogs.com/dongming/p/4452956.html