nginx安装和初次启动

使用redhat5.4

由于已经配置yum,所以nginx所以来的包都可以通过yum来安装。

如果需要配置yum请参考http://blog.csdn.net/ldwtill/article/details/8510939

一、依赖的程序

1.yum install gcc*

2. yum install  zlib 

3. yum install  pcre*  
4. yum install  openssl *


二、安装 
./configure 
make 
make install

默认安装的路径是/usr/local/nginx

更多的安装配置 
./configure --prefix=/usr/local/nginx 
--with-openssl=/usr/include (启用ssl) 
--with-pcre=/usr/include/pcre/ (启用正规表达式) 
--with-http_stub_status_module (安装可以查看nginx状态的程序) 
--with-http_memcached_module (启用memcache缓存) 
--with-http_rewrite_module (启用支持url重写)

三、启动

cd /usr/local/nginx/

./nginx &。

打开浏览器在地址栏输入127.0.0.1然后会出现一句话 welcome to nginx

就是成功了。

四、其他

nginx 默认是配置80端口,如果端口被占用,那么就修改nginx 安装目录下的  conf/nginx.conf 文件。然后重启nginx。


参考:http://www.cnblogs.com/xd502djj/archive/2011/11/23/2260239.html



但是安装成功后发现有无法配置负载均衡权重的问题。

于是,更换成其他版本nginxnginx-0.8.50

安装如下:

./configure\

 

 --prefix=/opt/nginx-0.8.50\

 --with-http_sub_module\

 --with-http_stub_status_module\

 --with-http_addition_module\

 --with-http_realip_module\

 --add-module=../ngx_cache_purge-1.4

 

make

makeinstall

 

ln-s /opt/nginx-0.8.50 /usr/local/nginx

killallnginx

/usr/local/nginx/sbin/nginx-t


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值