zoukankan      html  css  js  c++  java
  • TP5框架 nginx服务器 配置域名 隐藏index.php

    server {
            listen       80;
            #server_name  localhost;
        server_name  hhy.com;/**这里写自己的域名*/
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            # root    "F:/PHPstudy/PHPTutorial/WWW";
        root    "F:/PHPstudy/PHPTutorial/WWW/ShopMall";
    
            location / {
                index  index.html index.htm index.php l.php;
                /**下面的if判断就是隐藏index.php*/
            if (!-e $request_filename) {
                rewrite  ^(.*)$  /index.php?s=/$1  last;
                break;
                }
               autoindex  off;
            }
    
            #error_page  404              /404.html;
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }

    nginx服务器的配置文件是 nginx.conf ,注意配置文件的最后是否有加载其他配置文件

    打开我的电脑,目录是C:WindowsSystem32driversetc下的hosts文件,在最下面加上127.0.0.1 hhy.com,添加的域名一定要跟nginx的配置文件中设置的域名一致

  • 相关阅读:
    gin内置验证器使用
    model
    work,工作模式
    orm框架
    simple模式下rabbitmq的代码
    rabbitmq介绍
    订阅模式
    路由模式
    redis五大数据类型
    Go操作redis
  • 原文地址:https://www.cnblogs.com/huanghanyi/p/10716449.html
Copyright © 2011-2022 走看看