您的位置:首页 > 运维架构 > Nginx

nginx编译

2014-04-25 10:39 239 查看
执行如下的命令,编译nginx。其中add-module为添加指定的模块,其中的路径可以根据实际的情况进行修改。同样需要进行修改的还有with-openssl参数。

tar vzxf openssl-0.9.8q.tar.gz

tar vzxf nginx-1.4.1.tar.gz

tar vzxf nginx-dynamic-etags.tar.gz

tar vzxf nginx-gridfs.tar.gz

tar vzxf
nginx_http_push_module-0.692.tar.gz

cd nginx-1.4.1

./configure
--prefix=/usr/local/nginx-1.4.1/ --user=www --group=www
--with-http_gzip_static_module --with-http_ssl_module
--with-http_stub_status_module --without-http_ssi_module
--without-http_autoindex_module --without-http_uwsgi_module
--with-http_realip_module --with-openssl=/root/pec/openssl-0.9.8q --add-module=/root/pec/nginx_http_push_module-0.692
--add-module=/root/pec/nginx-gridfs/
--add-module=/root/pec/nginx-dynamic-etags

make && make install

cd /usr/local/

ln -s /usr/local/nginx-1.4.1/ nginx

cd ..

cp conf/rewrite.conf
/usr/local/nginx/conf/

cp conf/nginx.conf /usr/local/nginx/conf/

cp conf/vhost.conf /usr/local/nginx/conf/

cp conf/nginx /etc/init.d/

最后的四条命令是拷贝conf文件夹下的nginx.conf、rewrite.conf和vhost.conf三个文件到/usr/local/nginx/conf目录下,最后将服务脚本拷贝到系统目录。 可以按照实际的情况修改其中的配置。

有一点需要注意的是,由于我们在nginx中配置了mongodb的组件,因此当mongodb没有起来的时候,直接启动nginx只会启动nginx的主进程。在启动nginx之前应该先启动mongodb。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: