1. 程式人生 > >TP5框架 nginx服務器 配置域名 隱藏index.php

TP5框架 nginx服務器 配置域名 隱藏index.php

dex 文件中 col driver class nginx服務器 drive edi serve

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:\Windows\System32\drivers\etc下的hosts文件,在最下面加上127.0.0.1 hhy.com,添加的域名一定要跟nginx的配置文件中設置的域名一致

TP5框架 nginx服務器 配置域名 隱藏index.php