安装 nginx 所需要的pcre库 即:perl 兼容正则表达式    

        yum install pcre pcre-devel -y


        rpm -qa pcre pcre-devel

        检查是否安装好pcre-devel,openssl-devel,

        rpm -qa pcre-devel pcre

        [root@kingle0001 ~]# rpm -qa openssl-devel openssl

                             openssl-devel-1.0.1e-57.el6.x86_64

                             openssl-1.0.1e-57.el6.x86_64


        rpm -qa openssl-devel openssl

        [root@kingle0001 ~]# rpm -qa openssl-devel openssl

                             openssl-1.0.1e-57.el6.x86_64 少了一个

        [root@jinc1 nginx-1.15.1]# yum install openssl-devel openssl  --下载一下


开始安装Nginx

        下载:wget -q http://nginx.org/download/nginx-1.15.1.tar.gz


        useradd nginx -s /sbin/nologin -M


        tar -zxvf nginx-1.6.3.tar.gz


        cd nginx-1.15.1


        ./configure --user=nginx --group=nginx --prefix=/application/nginx-1.15.1/ --with-http_stub_status_module --with-http_ssl_module


        make


        make install


        ln -s /application/nginx-1.15.1 /application/nginx/


        /application/nginx/  --该文件夹为自己创建


启动:  /application/nginx/nginx-1.15.1/sbin/nginx


 进不去欢迎界面解决方法

关闭selinux

            setenforce 0 临时关闭

            永久关闭编辑文件/etc/selinux/config

关闭防火墙

            /etc/init.d/iptables stop 关闭防火墙


            chkconfig iptables off 开机自启关闭


            /etc/init.d/iptabes status 查看防火墙当前状态


查看80端口信息 netstat -lnt|grep 80


查看nginx进程 ps-ef|grep nginx

查看nginx的错误日志  cat /application/nginx/nginx-1.15.1/error.log


 ping 10.0.0.200 看是否连通


wegt 10.0.0.200 或者curl -I 10.0.0.200 模拟用户

一个小坑

     [root@jinc2 nginx]# ./sbin/nginx -s reload

      nginx: [error] invalid PID number "" in "/lnmp/nginx-1.15.1//logs/nginx.pid"

今天偶然出现了这个错误,问了一下百度大神,,都说是因为是加载配置文件报的错,所以用-c 选项指定配置文件

     [root@jinc2 nginx]# ./sbin/nginx -c /lnmp/nginx-1.15.1//conf/nginx.conf

     nginx: [emerg] bind() to 10.0.0.100:80 failed (98: Address already in use)

     nginx: [emerg] bind() to 10.0.0.101:80 failed (98: Address already in use)

     nginx: [emerg] bind() to 10.0.0.102:80 failed (98: Address already in use)

     nginx: [emerg] bind() to 10.0.0.100:80 failed (98: Address already in use)

     nginx: [emerg] bind() to 10.0.0.101:80 failed (98: Address already in use)

     nginx: [emerg] bind() to 10.0.0.102:80 failed (98: Address already in use)

     [root@jinc2 nginx]# ./sbin/nginx -s reload

     nginx: [error] invalid PID number "" in "/lnmp/nginx-1.15.1//logs/nginx.pid"

按照网上的思路试了一遍,发现并没有什么用,然后,仔细看了一下错误,大概意思是无效的pid,在lnmp/nginx-1.15.1//logs/nginx.pid 这个文件中,于是,打开这个文件看了一下。。。怎么什么都没有。。有点蒙蔽。继续。。去另一台看了一下

     [root@jinc1 conf]# cat /application/nginx/nginx-1.15.1/logs/nginx.pid

     7104

原来并不是空的,然后,在另一台继续查了一下他的pid

      [root@jinc1 conf]# ps -ef | grep nginx

      root       7104      1  0 03:30 ?        00:00:00 nginx: master process ../sbin/nginx

哇哇哇,原来如此,,,回到本机,查看pid

     [root@jinc2 nginx]# ps -ef |grep nginx

     root       9862      1  0 03:21 ?        00:00:00 nginx: master process ./sbin/nginx

现在好办了,加进去试试

     [root@jinc2 nginx]# echo 9862 > /lnmp/nginx/logs/nginx.pid

     [root@jinc2 nginx]# ./sbin/nginx -s reload

     [root@jinc2 nginx]#

 已经ok了,nice