nginx

1 nginx安装


1.1  安装PCRE

tar-zxvf pcre-8.02.tar.gz

./configure–prefix=/usr/local/pcre

make&& make install

若不指定prefix,则默认安装到/usr/local/lib下。

安装完成后可以#ls-l/usr/local/lib/libpcre.so

1.2  安装zlib

./configure–prefix=/usr/local/zlib

make&& make install

1.3  安装openssl

./config–prefix=/usr/local/openssl

make&& make install

1.4  安装nginx

tarzxvf nginx-1.0.11.tar.gz

cdnginx-1.0.11

./configure \

--prefix=/usr/local/nginx

--with-pcre=../pcre-8.30

--with-zlib=../zlib-1.2.8

--with-openssl=../openssl-1.0.1e

--with-http_stub_status_module

make&& make install

//--with-http_stub_status_module监控当前nginx状态

//--with-pcre=DIR是设置源码目录,而不是编译安装后的目录。

//默认配置文件/usr/local/nginx/conf/nginx.conf

1.5  安装nginx模块(非覆盖安装)(未测试)

nginx -V 可以查看原来编译时都带了哪些参数

原来的参数:

--prefix=/usr/local/nginx --with-poll_module--with-http_stub_status_module --with-pcre=../pcre-8.30

添加的参数: 

--with-http_stub_status_module --with-http_ssl_module--with-http_realip_module

步骤如下:

l   a.使用参数重新配置:

./configure --prefix=/usr/local/nginx --with-poll_module--with-http_stub_status_module --with-pcre=../pcre-8.30 -user=nobody-group=nobody--with-http_stub_status_module \
--with-http_ssl_module --with-http_realip_module \
--add-module=../nginx_upstream_hash-0.3.1/ \
--add-module=../gnosek-nginx-upstream-fair-2131c73/

l   b.编译:make

#不要makeinstall,否则就是覆盖安装

l   c.替换nginx二进制文件:

cp /app/nginx/sbin/nginx /app/nginx/sbin/nginx.bak

cp ./objs/nginx /app/nginx/sbin/

2 nginx配置

启动:/usr/local/nginx/sbin/nginxcp /usr/local/nginx/sbin/nginx/etc/init.d/nginx

停止:/usr/local/nginx/sbin/nginx-sstop     nginx –s stop

重启:/usr/local/nginx/sbin/nginx-sreload  nginx –s reload

nginx服务器状态:netstat-autlp| grep nginx

nginx端口状态: netstat -antl|grep 9000

php-cgi程序:     ps -ef|grep php-cgi

查看nginx安装: ps–ef|grep nginx

查看原编译时所带参数:nginx-V

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值