我正在尝试为我的 Laravel 项目设置 Laradock。我从一个新的 laravel 项目开始,只是为了在尝试我当前的项目之前进行测试。我按照教程进行了操作,但是在执行步骤的某个地方,我认为我一定搞砸了,因为当我浏览 URL 时,我得到一个“404 not found nginx”。有人以前经历过这种情况或知道可能出了什么问题吗?提前致谢!
我在 /var/wwwlaradock/nginx/sites 中的 example.conf
server {
listen 80;
listen [::]:80;
server_name example.local;
root /var/www/example/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location /.well-known/acme-challenge/ {
root /var/www/letsencrypt/;
log_not_found off;
}
error_log /var/log/nginx/laravel_error.log;
access_log /var/log/nginx/laravel_access.log;
}
我的主机文件
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 example.local
我的 laravel 项目的名称是“example”,位于/var/www