码迷,mamicode.com
首页 > 其他好文 > 详细

azure 云上安装部署nginx

时间:2016-03-24 01:23:26      阅读:600      评论:0      收藏:0      [点我收藏+]

标签:

在安装nginx之前可以先安装libevent,安装libevent步骤如下:
1.下载libevent:
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz


2.解压libevent:
tar -zxvpf libevent-2.0.21-stable.tar.gz


3.进入解压目录:
cd libevent-2.0.21-stable


4.指定安装目录:
./configure --prefix=/usr/local/libevent-2.0.21


5.安装libevent:
make
make install


本blog来源地址:http://blog.csdn.net/mchdba/article/details/50967970,不经过原作者mchdba(黄杉)允许,谢绝转载。


6,安装nginx
yum install -y openssl*
tar -xvf pcre-8.31.tar.gz -C /usr/local/
tar -xvf nginx-1.4.2.tar.gz
cd nginx-1.4.2
./configure   --with-http_ssl_module --prefix=/usr/local/nginx   --with-pcre=/usr/local/pcre-8.31 --with-http_stub_status_module 


pS:首席编译脚本 1.121/122
yum -y install gcc automake autoconf libtool make
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_realip_module --with-http_gzip_static_module  --with-http_ssl_module --with-pcre=/usr/local/pcre-8.31


make
make install


7,查看编译参数:

/usr/local/nginx/sbin/nginx -V 



8,使用nginx帐号启动
setcap CAP_NET_BIND_SERVICE=+ep /usr/local/nginx/sbin/nginx
要先用root帐号运行 /usr/local/nginx/sbin/nginx 启动,然后kill掉nginx进程
再切换到nginx帐号执行service nginx restart或者/usr/local/nginx/sbin/nginx 启动,就会看到进程是用nginx帐号在启动了



9,报错调试
[nginx@lb_net_1 ~]$ service nginx start
start nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
nginx is running[nginx@lb_net_1 ~]$
[nginx@lb_net_1 ~]$ exit
logout
[root@lb_net_1 conf]# 
[root@lb_net_1 conf]# sudo chown root:wheel /usr/local/nginx/sbin/nginx 
[root@lb_net_1 conf]# sudo chmod u+s /usr/local/nginx/sbin/nginx
[root@lb_net_1 conf]# 
[root@lb_net_1 conf]# su - nginx 
[[root@lb_net_1 conf]# sudo chmod u+x /usr/local/nginx/sbin/nginx
之后进入nginx帐号启动成功了。

azure 云上安装部署nginx

标签:

原文地址:http://blog.csdn.net/mchdba/article/details/50967970

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!