zoukankan      html  css  js  c++  java
  • CnetOS7使用yum方式安装nginx

      之前一直使用源码包安装,但是对于需要一直进行重新安装的测试环境来说安装起来还是过于麻烦了。今天搜索发现能够进行yum方式的安装,特此记录。

      新建yum文件,yum源是nginx的官网。

    # vim /etc/yum.repos.d/nginx.repo
    
    [nginx]
    name=nginx.org
    baseurl=http://nginx.org/packages/mainline/rhel/7/$basearch/
    enabled=1
    gpgcheck=0

      然后直接进行安装即可

    # yum install nginx -y

      将nginx服务加入开机自启动,默认安装完服务是没有开启的,需要手动进行开启。

    # systemctl enable nginx.service
    # systemctl restart nginx.service

      查看端口状态,打开防火墙

    # ss -anp | grep nginx
    # firewall-cmd --permanent --add-service=http
    # firewall-cmd --permanent --add-service=https
    # firewall-cmd --reload

      通过网页查看是否能够访问nginx主页(http://[nginx服务器IP]),如果能够访问,则安装完成。

  • 相关阅读:
    CLR Via
    HTML&XML
    SNS研究
    DotNet&C#
    电子商务
    WCF学习
    SQL
    构架设计
    JS&Ajax
    NHibernate之旅系列文章导航
  • 原文地址:https://www.cnblogs.com/cdinc/p/5772981.html
Copyright © 2011-2022 走看看