【发布时间】:2019-02-08 09:06:41
【问题描述】:
我已经上传了一张图片到服务器,除了我需要在 URL 中添加storage 来访问来自 Laravel 的公共目录的图片之外,一切都设置正确。
https://example.com/a/xyz.png - 不可访问
https://example.com/storage/a/xyz.png - 可访问
但是在本地可以访问没有存储的 URL。
NGINX
root /var/www/example.in/live/public/;
index index.html index.php index.htm index.nginx-debian.html;
server_name example.in www.example.in;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
这不是我需要从 URL 中隐藏存储字的问题。我的问题是图像的 URL 默认情况下应该在没有存储字的情况下工作。它不工作。我的本地机器上由代客管理的相同代码在没有存储关键字的情况下工作正常
【问题讨论】:
-
在 htaccess 上更改
-
我在 nginx 上。可以为它添加什么?
-
欢迎来到 Stack Overflow。向我们展示您的代码。请访问帮助中心并阅读how to ask,以及如何创建minimal, complete, and verifiable example。
-
这可能是 stackoverflow.com/questions/30194198/… 的副本。因为这可以使用 htaccess 存档(htaccess 是 njot 取决于 apache 或 nginx;它在两者上都有效)