1.到官方站点卸载nginx-1.6.3版本的源码包
http://nginx.org/en/download.html
http://nginx.org
2.安装依赖包和编译工具
yum -y install gcc gcc-c++ autoconf automake
yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
说明:nginx的重写功能依赖pcre-devel包
2.解压源码包
[iyunv@bogon tmp]# tar xf nginx-1.6.3.tar.gz
[iyunv@bogon tmp]# cd nginx-1.6.3
[iyunv@bogon nginx-1.6.3]# ./configure --help
--help print this message
--prefix=PATH (程序安装路径) set installation prefix
--sbin-path=PATH (nginx主程序安装路径) set nginx binary pathname
--conf-path=PATH (主配置文件安装路径) set nginx.conf pathname
--error-log-path=PATH(错误日志安装路径) set error log pathname
--pid-path=PATH (pid文件路径) set nginx.pid pathname
--lock-path=PATH (锁文件路径 ) set nginx.lock pathname
--user=USER (work进程的运行身份,一般为普通用户) set non-privileged user for
worker processes
--group=GROUP set non-privileged group for worker processes
……………………………………查看配置说明
3.添加用户和组
[iyunv@bogon nginx-1.6.3]# groupadd -r nginx
[iyunv@bogon nginx-1.6.3]# useradd -g nginx -r nginx
[iyunv@bogon nginx-1.6.3]# id nginx
uid=496(nginx) gid=493(nginx) 组=493(nginx)
4.编译nginx并配置安装路径,以及指明需要开启的模块
[iyunv@bogon nginx-1.6.3]# ./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-http_mp4_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi
说明:
--with-http_ssl_module:http的ssl模块
--with-http_stub_status_module:状态信息提供模块
--with-http_gzip_static_module:压缩静态资源的gzip模块
--with-http_flv_module:flv流媒体支持模块
--with-http_mp4_module:mp4流媒体支持模块
创建临时目录路径:
[iyunv@bogon nginx-1.6.3]# mkdir -pv /var/tmp/nginx/{client,proxy,fastcgi,uwsgi}
[iyunv@bogon nginx-1.6.3]# make && make install
5.启动nginx
[iyunv@bogon nginx-1.6.3]# /usr/local/nginx/sbin/nginx //启动nginx
查看80端口的监听状态:
[iyunv@bogon nginx-1.6.3]# ss -tnlp | grep nginx
LISTEN 0 128 *:80 *:* users:(("nginx",27544,6),("nginx",27545,6))
查看进程启动情况:
[iyunv@bogon nginx-1.6.3]# ps aux | grep nginx
root 27544 0.0 0.1 44584 1136 ? Ss Mar23 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 27545 0.0 0.1 45012 1712 ? S Mar23 0:00 nginx: worker process
root 27588 0.0 0.0 103320 872 pts/3 S+ 00:02 0:00 grep nginx
可以看到,运行了一个master主进程和一个worker子进程
6.访问nginx
http://192.168.1.102/
会出现nginx欢迎界面
over!
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com