zoukankan      html  css  js  c++  java
  • Nginx基础

    安装 yum install nginx
    启动 service nginx start
    停止 service nginx stop
    重载 service nginx reload

    systemctl命令:
    systemctl list-unit-files|grep nginx 查找
    systemctl start nginx //启动服务
    systemctl stop nginx //停止服务
    systemctl restart nginx //重启服务
    systemctl status nginx //查看服务当前状态
    systemctl enable nginx //设置开机自启动
    systemctl disable nginx //停止开机自启动

    安装epel
    yum install epel-release -y

    yum -y remove epel-release

    yum clean all && yum makecache

    cd /etc/yum.repos.d/

    sudo yum intsall nginx
    sudo systemctl start nginx 启动服务
    sudo firewall-cmd --permanent --zone=public --add-service=http 允许http通信
    sudo firewall-cmd --permanent --zone=public --add-service=https  允许https通信
    sudo firewall-cmd --reload 重新加载配置

    在 /etc/nginx/conf.d 目录中新建一个my.conf文件,在此之前先将nginx.conf 配置文件中的server节点注释掉

    server{
    listen 80;
    server_name www.test.com;
    root /wwwroot/demo;
    index index.html index.htm;
    }

    /wwwroot/demo
    index.html内容
    <html>
    <head>
    <meta charset="UTF-8">
    <title>这是一个测试页面</title>
    </head>
    <body>
    <h1>测试页面</h1>
    </body>
    </html>


    sudo nginx -s reload 重新加载配置文件
    sudo systemctl restart nginx 重启nginx

    修改hosts 文件配置自定义域名
    windows位置:C:WindowsSystem32driversetchosts
    192.168.3.89 www.test.com
    刷新 dns:ipconfig /flushdns

    linux位置 /etc/hosts

    //访问站点403错误原因:SELinux设置为开启状态(enabled)的原因
    将SELINUX=enforcing 修改为 SELINUX=disabled 状态
    vim /etc/selinux/config
    #SELINUX=enforcing
    SELINUX=disabled
    重启生效:reboot

    sudo setenforce 0

  • 相关阅读:
    如何使用Java计算货币/钱~(How to calculate monetary values in Java)
    BigDecimal类
    状态码定义
    常见服务器返回状态码(Status Codes)
    2020-3-26学习地图
    ReentrantLock类
    HashSet类
    Vector类
    课程总结
    第十四周课程总结&实验报告
  • 原文地址:https://www.cnblogs.com/marshhu/p/9728935.html
Copyright © 2011-2022 走看看