在安装nginx前,需要确保系统安装了g++、gcc、openssl-devel、pcre-devel和zlib-devel软件。安装必须软件:
yum install gcc-c++
yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
将安装包文件上传到/usr/local中执行以下操作:
tar -zxv -f nginx-1.2.6.tar.gz
cd /usr/local/nginx-1.2.6
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module && make
make install
启动
cd /usr/local/nginx/sbin
./nginx
停止
pkill -9 nginx
平滑重启
./nginx -s reload