【发布时间】:2020-01-24 04:13:13
【问题描述】:
我有一个 digitalocean droplet,我想运行一个 laravel 项目。我用这个教程https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04
问题是它显示 403。我在其他问题上看到他们错过了公共目录或路径错误,但在我的情况下,当我的公共目录正确时,我得到了 403,而当我得到了 500我错了。
我的 nginx 错误日志显示
2017/09/29 13:58:16 [error] 15176#15176: *2 directory index of "/var/www/laravel/public/" is forbidden
我的 nginx 站点-available/my-site.com
server {
listen 80;
listen [::]:80;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/laravel/public;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name my-site.com www.my-site.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
}
【问题讨论】:
-
被禁止目录权限是否正确?像 775 什么的?
-
是的,还有 chown -R www-data:www-data
-
发布完整的 nginx 配置