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

nginx1.9源码安装

2016-03-05 11:06 525 查看
操作系统环境
[root@nginx-web ~]# cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
[root@nginx-web ~]# uname -r
2.6.32-358.el6.x86_64
[root@nginx-web ~]# uname -m
x86_64


安装依赖组件

[root@nginx-web ~]# yum install make gcc gcc-c++ openssl-devel unzip -y


安装pcre
[root@nginx-web ~]# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.zip [root@nginx-web ~]# unzip pcre-8.38.zip
[root@nginx-web ~]# cd pcre-8.38
[root@nginx-web pcre-8.38]# ./configure --prefix=/usr/local/pcre
[root@nginx-web pcre-8.38]# make && make install


安装nginx

[root@nginx-web ~]# wget http://nginx.org/download/nginx-1.9.12.tar.gz [root@nginx-web ~]# tar fxz nginx-1.9.12.tar.gz
[root@nginx-web ~]# cd nginx-1.9.12
[root@nginx-web nginx-1.9.12]# ./configure --prefix=/usr/local/nginx --user=www --group=www  --with-http_ssl_module  --with-http_dav_module --with-pcre=/root/pcre-8.38
[root@nginx-web nginx-1.9.12]# make && make install
[root@nginx-web nginx-1.9.12]# useradd www -s /sbin/nologin -M


启动nginx
[root@nginx-web ~]# /usr/local/nginx/sbin/nginx
查看nginx端口
[root@nginx-web ~]# netstat -ntpl|grep nginx
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      14778/nginx

使用curl访问下

[root@nginx-web ~]# curl -I http://127.0.0.1 HTTP/1.1 200 OK
Server: nginx/1.9.12
Date: Sat, 05 Mar 2016 02:32:23 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Sat, 05 Mar 2016 02:31:33 GMT
Connection: keep-alive
ETag: "56da4505-264"
Accept-Ranges: bytes
至此nginx源码安装完成!!
本文出自 “村里的男孩” 博客,转载请与作者联系!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: