【发布时间】:2021-09-26 02:19:18
【问题描述】:
我已将 Laravel 8 应用程序放在 AWS t2.nano Linux AMI ec2 实例上。我想先说我已经在这里待了大约一天。我已经尝试了一些配置。
这是我尝试过的一些配置:
-
来自 Laravel 8 文档的默认 nginx 配置文件 https://laravel.com/docs/8.x/deployment#nginx
-
此处引用的另一个非常相似的 stackoverflow 问题 Laravel on nginx says 404 for all routes except index
归根结底,我无法让它正常工作。我的索引页面加载,但任何其他路线最终都在 404 页面。您可以在此处查看应用程序。 https://technology.dvemedia.com/
这里有一些技术规格和我的 conf 文件的当前状态。
- Laravel - 8
- PHP - 7.4
- NGINX - 1.12.2
# HTTP
server {
listen 80;
listen [::]:80;
server_name technology;
return 301 https://$host$request_uri; # Redirect to www
}
server {
listen 80;
listen [::]:80;
server_name technology.dvemedia.com;
root /var/www/html/technology/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 unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fixes timeouts
fastcgi_read_timeout 600;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
我遗漏了什么或做错了什么,因为我无法让它去拯救我的生命。
【问题讨论】:
标签: php linux laravel nginx amazon-ec2