nginx
环境 centos 6.7
安装Nginx准备工作
安装PCRE (perl兼容的正则表达式)
[root@zero ~]# yum install pcre pcre-devel -y
安装ssl
[root@zero ~]# yum install openssl-devel -y
安装Nginx
下载到
[root@zero tools]# wget http://nginx.org/download/nginx-1.6.3.tar.gz
减压
[root@zero tools]# tar -zxf nginx-1.6.3.tar.g
进入减压后的目录
[root@zero tools]# cd nginx-1.6.3
由于编译的时候需要用到用户,这里我们先创建相应用户
[root@zero ~]# useradd nginx
设置安装参数
[root@WEB_LNMP01 nginx-1.6.3]# ./configure --prefix=/application/nginx-1.6.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module
查看是是否有报错
[root@WEB_LNMP01 nginx-1.6.3]# echo $?
编译和安装
[root@WEB_LNMP01 nginx-1.6.3]# make
[root@WEB_LNMP01 nginx-1.6.3]# make install
设置软连接,方便以后维护
[root@WEB_LNMP01 tools]# ln -s /application/nginx-1.6.3/ /application/nginx
启动 nginx
[root@WEB_LNMP01 tools]# /application/nginx/sbin/nginx
查看安装配置
[root@WEB_LNMP01 tools]# /application/nginx/sbin/nginx -V
nginx version: nginx/1.6.3
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/application/nginx-1.6.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module
去掉空行和注释,使得nginx,conf最简化
[root@zero conf]# egrep -v "#|^$" nginx.conf.default >nginx.conf
检查语法
[root@zero www]# /application/nginx/sbin/nginx -t
重启生效
[root@zero www]# /application/nginx/sbin/nginx -s reload