1)确保以安装开发工具和开发库
2)卸载已安装的其他web服务软件
3)新建用户:nginx
4)安装依赖库
# yum -y install pcre-devel
[root@web01 nginx-package]# tar -zxfnginx-0.8.55.tar.gz
./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
[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
[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
原文:http://huanglianfeng.blog.51cto.com/4813074/1368832