zoukankan      html  css  js  c++  java
  • Linux 安装 Nginx

     

    1. 下载 Nginx

      wget http://nginx.org/download/nginx-1.12.2.tar.gz

    2. 安装Nginx所需依赖

      yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

       

    3. 解压 Nginx

      tar -zxvf nginx-1.12.2.tar.gz

       

    4. 执行配置

      ./configure
    5. 编译安装(默认安装在/usr/local/nginx)

      make
      make install
    6. 测试安装

      # cd到刚才配置的安装目录/usr/loca/nginx/
      ./sbin/nginx -t

      输出如下表示安装成功

      nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
      nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
    7. 启动 Nginx

      cd /usr/local/nginx/sbin
      ./nginx //启动nginx
    8. 配置开机启动

      vim /etc/rc.d/rc.local
    9. 查看是否安装成功

      http://139.199.177.202/ (此处使用自己的服务器 IP 地址)

      出现图示便安装成功!

       

    10. 其他指令

      # 查看版本
      cd /usr/local/nginx/sbin/   # 进入安装目录
      ./nginx -v
      ​
      # 查看 Nginx 是否启动
      ps -ef | grep nginx
      ​
      # 关闭 Nginx
      ./nginx -s stop
      ​
      # 启动 
      ./nginx
      ​
      # 重新加载
      ./nginx -s reload
      ​
      # 配置文件位置
      /usr/local/nginx/conf/nginx.conf
       
  • 相关阅读:
    机器人
    仙岛求药(一)
    YZM 二分查找
    珠心算测验升级版
    博客正在施工
    【其他】16年12月博客阅读索引^_^
    博客有新家了!
    POJ No.3617【B008】
    POJ No.2386【B007】
    【刷题记录】部分和问题
  • 原文地址:https://www.cnblogs.com/damaoa/p/12778566.html
Copyright © 2011-2022 走看看