【问题标题】:How to configure Nginx for Limonade PHP micro framework?如何为 Limonade PHP 微框架配置 Nginx?
【发布时间】:2013-06-04 12:13:39
【问题描述】:

Limonade PHP 微框架适用于 Nginx。但是,我想获得“漂亮的网址”功能,但我不知道如何。例如,我可以毫无问题地访问http://a.com/?/about,但我想让http://a.com/about 可用。

Limonade PHP 微框架提供了一个.htacess 文件来启用 Apache 中的“pretty url”功能,但我不知道如何使用 Nginx。

我试过了:

location / { rewrite ^(.*)$ /index.php?uri=/$1 break; }

它似乎工作。我可以访问http://a.com/about而不是http://a.com/?/about,但是服务器的响应非常慢,并且框架函数url_for()无法正常工作,所以肯定是缺少了什么。

谁能帮我找到正确的配置方法?

【问题讨论】:

    标签: php nginx rewrite


    【解决方案1】:

    这有点晚了,但在最新版本的框架中,这应该可以工作。把它放在你的 nginx.conf 中的 server {} 部分:

    try_files $uri $uri/ /index.php?$args;
    

    此功能已添加到此 pull request

    请在讨论选项卡中查看 sloonz 的 cmets 了解更多信息。

    猜你喜欢
    • 1970-01-01
    • 2017-06-15
    • 2013-02-25
    • 1970-01-01
    • 1970-01-01
    • 2021-01-01
    • 2015-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多