在在线主机中将 NGINX 重写为 Laravel 5

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31494531/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 11:58:13  来源:igfitidea点击:

Rewrite of NGINX to Laravel 5 in an online host

phplaravelnginxurl-rewritinglaravel-5

提问by ahmad elsaeed

I want to know the path of the configuration file for Nginx server in an online host to remove index.php from the URL.

我想知道在线主机中Nginx服务器的配置文件的路径,以从URL中删除index.php。

For ex http://site/public/index.php/moreshould be converted to http://site/more

对于 ex http://site/public/index.php/more应转换为http://site/more

回答by ssuhat

On Nginx, the following directive in your site configuration will allow "pretty" URLs:

在 Nginx 上,站点配置中的以下指令将允许“漂亮”的 URL:

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

http://laravel.com/docs/5.0/installation#pretty-urls

http://laravel.com/docs/5.0/installation#pretty-urls