zoukankan      html  css  js  c++  java
  • nginx虚拟机无法访问解决

    1、重要:修改配置文件使用虚拟机,否则怎么配置都不生效,添加如下用户
    
    [root@host-10-1-1-161 html]# ll /etc/nginx/nginx.conf
    -rw-r--r-- 1 root root 345 Aug 26 10:41 /etc/nginx/nginx.conf
    [root@host-10-1-1-161 html]# vi /etc/nginx/nginx.conf
    user root root;                    #说明:这里的user根据 自己的nginx.conf文件所在的目录的属主属性而定 
    worker_processes 1;
    
    
    2、其他目录下的 html文件,必须写成 index.html 否则无法访问
    
    
    [root@host-10-1-1-161 ~]# curl http://127.0.0.1:8080
    <html>
    <head><title>403 Forbidden</title></head>
    <body bgcolor="white">
    <center><h1>403 Forbidden</h1></center>
    <hr><center>nginx/1.12.2</center>
    </body>
    </html>
    [root@host-10-1-1-161 ~]# mv /web/sing/sina.html /web/sing/index.html
    [root@host-10-1-1-161 ~]# 
    [root@host-10-1-1-161 ~]# curl http://127.0.0.1:8080
    <html>
    <p>
    this is my nginx
    </p>
    </html>
  • 相关阅读:
    liunx下手动安装git及配置
    Liunx系统下删除自带的JDK及安装需要的JDK版本
    Pipeline简单实现的代码
    HttpClient-post请求,含图片
    Java
    函数及BOM
    JS--EcmaScript
    定位
    浮动
    盒子模型
  • 原文地址:https://www.cnblogs.com/effortsing/p/10012447.html
Copyright © 2011-2022 走看看