zoukankan      html  css  js  c++  java
  • centos 7 nginx 安装

    1、下载nginx rpm包

          下载地址:http://nginx.org/packages/mainline/centos/7/x86_64/RPMS/ ,可查看所有安装包

           从中如下载:

           wget http://nginx.org/packages/mainline/centos/7/x86_64/RPMS/nginx-1.11.5-1.el7.ngx.x86_64.rpm

     2、安装nginx

          rpm -ivh nginx-1.11.5-1.el7.ngx.x86_64.rpm

    3、检查是否安装成功

         nginx -v

         输入此命令后显示nginx版本信息

    4、开启服务

        查看服务状态命令:systemctl status nginx.service

        开启/停止/重启服务命令:systemctl start/stop/restart nginx.service 如开启服务:systemctl start nginx.service

        开机启动/取消命令:systemctl enable/disable nginx.service  开机启动:systemctl enable nginx.service 

    5、查看服务是否正常

        打开浏览器,输入地址:http://localhost  会显示nginx欢迎界面

        无界面情况下,可以通过telnet loaclhost 80(telnet 127.0.0.1  80) 查看80端口是否开启(telnet没有安装 可以通过yum install telnet),然后输入任意字符比如"d",telnet 窗口返回服务器信息 

    [root@localhost /]# telnet localhost 80
    Trying ::1...
    telnet: connect to address ::1: Connection refused
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    d
    HTTP/1.1 400 Bad Request
    Server: nginx/1.11.5
    Date: Thu, 03 Nov 2016 02:20:49 GMT
    Content-Type: text/html
    Content-Length: 173
    Connection: close
    
    <html>
    <head><title>400 Bad Request</title></head>
    <body bgcolor="white">
    <center><h1>400 Bad Request</h1></center>
    <hr><center>nginx/1.11.5</center>
    </body>
    </html>
    Connection closed by foreign host.

    在信息输出http头信息里面含Server: nginx/1.11.5,表示nginx已经提供服务

       

          

  • 相关阅读:
    codeforces484A
    codeforces559B
    spfa算法及判负环详解
    清北学堂提高组突破营考试T1
    lemon用法
    清北学堂提高组突破营游记day6
    清北学堂提高组突破营游记day5
    POJ-1679 The Unique MST (判断最小生成树的唯一性)
    HDU 4553 约会安排 (区间合并)【线段树】
    POJ 1236 Network Of Schools (思维+强连通)
  • 原文地址:https://www.cnblogs.com/hobinly/p/5996664.html
Copyright © 2011-2022 走看看