# 安装pcre库(Perl Compatible Regular Expressions;perl兼容正则表达式),为了使nginx支持具备URL重写功能的Rewrite模块。
[root@kazihuo ~]# yum -y install pcre pcre-devel
[root@kazihuo ~]# yum -y install openssl openssl-devel gcc
[root@kazihuo ~]# rpm -qa pcre pcre-devel
[root@kazihuo ~]# wget http://nginx.org/download/nginx-1.12.1.tar.gz
[root@kazihuo ~]# tar axvf nginx-1.12.1.tar.gz
[root@kazihuo ~]# useradd nginx -s /sbin/nologin -M
[root@kazihuo ~]# cd nginx-1.12.1
[root@kazihuo ~]# ./configure --help
[root@kazihuo ~]# ./configure --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --prefix=/usr/local/nginx-1.12.1/
[root@kazihuo ~]# echo $? # 根据返回值判断是否正常编译
0
[root@kazihuo ~]# make # C语言编译的过程
[root@kazihuo ~]# make install #把编译的内容进行安装
[root@kazihuo ~]# ln -sv /usr/local/nginx-1.12.1 /usr/local/nginx
[root@kazihuo ~]# echo ‘export PATH=$PATH:/usr/local/nginx/sbin/’ > /etc/profile.d/nginx.sh
[root@kazihuo ~]# source /etc/profile.d/nginx
[root@kazihuo ~]# nginx -t
[root@kazihuo ~]# nginx
[root@kazihuo ~]# curl -I 127.0.0.1
HTTP/1.1 200 OK Server: nginx/1.12.1 Date: Sun, 15 Jul 2018 03:47:36 GMT Content-Type: text/html Content-Length: 612 Last-Modified: Sun, 15 Jul 2018 03:31:02 GMT Connection: keep-alive ETag: "5b4abff6-264" Accept-Ranges: bytes
-------------------------------------------------------------
转载请保留此段声明,且在文章页面明显位置给出原文链接,谢谢!
------------------------------------------------------------------------------
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!
------------------------------------------------------------------------------