【问题标题】:nginx config Location for pretty urls in laravelnginx 配置 laravel 中漂亮 url 的位置
【发布时间】:2017-12-27 23:36:59
【问题描述】:

我在互联网上找不到信息。

我正在尝试创建一个管理区域,但留下一个没有密码的 webhook(我使用 htpassword)但由于某种原因无法正常工作,可能与 laravel 的漂亮网址有关

这是有效的,资产是一个真正的文件夹

location /assets/ {
    auth_basic          off;
    allow all;
}

这不起作用:

location /index.php/webhook {
    auth_basic          off;
    allow all;
}

所以我添加了这个但也不起作用:

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

所以我用斜线结束了这个,location /index.php/webhook/ 但仍然没有。

供参考:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name xxx.com;
    auth_basic "Restricted Content";
    auth_basic_user_file /etc/nginx/.htpasswd;
    root /home/www;
    #more configs like ssl#

    location / {
        limit_req   zone=login  burst=5  nodelay;
        limit_req_status 503;
        try_files $uri $uri/ /index.php?$query_string;
    }
}

有什么想法吗? :)

【问题讨论】:

    标签: laravel nginx


    【解决方案1】:

    我尝试了像 https://user:pass@xxx.com 这样的嵌入式 url 凭据,但 webhook 与此身份验证不兼容。

    所以我最终做了一个解决方法,我将允许设置为 webhook 提供程序 IP,以便它们在没有用户/密码的情况下自动允许。

    简单吧?我花了 2 小时才发现这种可能性哈哈

    【讨论】:

      猜你喜欢
      • 2017-12-27
      • 1970-01-01
      • 2021-01-22
      • 2018-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-06
      • 2014-01-25
      相关资源
      最近更新 更多