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

源码安装nginx

2014-03-05 19:52 716 查看

准备工作:

1)确保以安装开发工具和开发库
2)卸载已安装的其他web服务软件
3)新建用户:nginx
4)安装依赖库
# yum -y install pcre-devel

1、解包

[root@web01 nginx-package]# tar -zxfnginx-0.8.55.tar.gz


2、配置

./configure常用选项
--prefix=PATH //指定安装路径
--user=USER
--group=GROUP
//为进程设置非特权用户的组
--with-http_stub_status_module //添加stub模块
--with-http_ssl_module//添加ssl模块

[root@web01 nginx-0.8.55]# ./configure--prefix=/usr/local/nginx --user=nginx  --group=nginx  --with-http_stub_status_module   --with-http_ssl_module


3、编译安装

[root@web01 nginx-0.8.55]# make &&make install


4、将nginx加入环境变量

[root@web01 ~]# vim .bash_profile
10 PATH=$PATH:$HOME/bin:/usr/local/nginx/sbin
[root@web01 ~]# source .bash_profile


5、启动nginx,并查看状态

[root@web01 ~]# nginx
[root@web01 ~]# netstat -anltp | grep nginx
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      8212/nginx
[root@web01 ~]#

监听端口:80
进程名:nginx
传输协议:tcp

6、访问测试

[root@web01 ~]# elinks --dump http://localhost Welcome to nginx!
[root@web01 ~]#


本文出自 “小风” 博客,请务必保留此出处http://huanglianfeng.blog.51cto.com/4813074/1368832
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: