CentOS 编译 Nginx 服务

1) 下载Nginx-1.0.0.tar.gz安装包并解压安装包并移动到/usr/local/nginx目录:

tar xvf nginx-1.0.0.tar.gz
mv nginx-1.0.0.tar.gz nginx

2)编译安装:

./configure --user=apache --group=apache --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --with-http_gzip_static_module --http-client-body-temp-path=/var/cache/nginx/client_body_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --without-http_scgi_module --without-http_uwsgi_module --with-http_ssl_module --with-md5=/usr/lib/openssl/ --with-sha1=/usr/lib/openssl/ --without-http_fastcgi_module
make
make install

3)建缓存文件夹和nginx启动脚本,并设置nginx开机启动:

mkdir /var/cache/nginx
wget http://files.cnblogs.com/showblog/nginx.zip  (启动脚本,下载解压生成nginx文件)
cp nginx /etc/init.d/nginx
chmod +x /etc/init.d/nginx
chkconfig --add nginx
chkconfig --level 2345 nginx on

你可能感兴趣的:(centos)