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

安装nginx

时间:2015-07-17 14:18:12      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:local   信息   

安装兼容包;

yum install -y pcre pcre-devel openssl openssl-devel


#下载 Nginx 源码包

cd /usr/src ;wget -c http://nginx.org/download/nginx-1.4.2.tar.gz


#解压 Nginx 源码包

tar -xzf nginx-1.4.2.tar.gz


#进入解压目录,然后 sed 修改 Nginx 版本信息为 WS

cd nginx-1.4.2 ; sed -i -e ‘s/1.4.2//g‘ -e ‘s/nginx\//WS/g‘ -e

‘s/"NGINX"/"WS"/g‘ src/core/nginx.h


#预编译 Nginx

useradd www ;./configure --user=www --group=www --prefix=/usr/local/nginx --with-

http_stub_status_module --with-http_ssl_module


#.configure 预编译成功后,执行 make 命令进行编译

make


#make 执行成功后,执行 make install 正式安装

make install


#自此 Nginx 安装完毕

/usr/local/nginx/sbin/nginx -t 检查 nginx 配置文件是否正确, 返回 OK 即正确。

[root@localhost ~]# /usr/local/nginx/sbin/nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

[root@localhost ~]#


然后启动 nginx,/usr/local/nginx/sbin/nginx 回车即可。查看进程是否已启动:

[root@localhost ~]# ps -ef |grep nginx

nobody 5381 30285 0 May16 ? 00:04:31 nginx: worker process

root 30285 1 0 2014 ? 00:00:00 nginx: master process

/usr/local/nginx/sbin/nginx

root 32260 32220 0 12:34 pts/0 00:00:00 grep nginx

[root@localhost ~]#


本文出自 “扑克脸” 博客,转载请与作者联系!

安装nginx

标签:local   信息   

原文地址:http://lirenpgood.blog.51cto.com/9747573/1675575

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