homestead中定制nginx 配置TP隐藏index.php

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/tclzsn7456/article/details/82661126

解决部署网站后不带index.php不能正常跳转字页面的问题:

一.找到homestead安装目录根目录,选择scripts目录,找到serve-xxx.sh,然后复制一份出来,改成自定义的名字如:serve-mcms,然后在该文件中加入如下配置:

location / {
        try_files \$uri \$uri/ /index.php?\$query_string;
        if (!-e \$request_filename){
            rewrite ^(.*)$ /index.php?s=\$1 last;
        }
    }

二.去homestead引入这个文件,引入是使用type关键字:

三.重启homestead

推荐使用工具:Vagrant,相当便捷

四.检查nginx配置

到此结束

猜你喜欢

转载自blog.csdn.net/tclzsn7456/article/details/82661126