• 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

  • 相关阅读:
    POJ 3253 Fence Repair STL 优先队列
    P1196 [NOI2002]银河英雄传说 题解
    UVA1316 Supermarket 题解
    P1955 [NOI2015]程序自动分析 题解
    P3807 【模板】卢卡斯定理 题解
    P2480 [SDOI2010]古代猪文 题解
    题解 P4778 【Counting swaps】
    P1313 计算系数 题解
    P3810 【模板】三维偏序(陌上花开)题解
    P1072 Hankson 的趣味题 题解
  • 原文地址:https://www.cnblogs.com/marshhu/p/9728935.html
Copyright © 2020-2023  润新知