我正在这里的 Amazon Lightsail 服务器(18.134.48.92)上运行 Laravel 10.x 应用程序
当前浏览至http://18.134.48.92/登录我正确显示了登录页面(我使用的是 Laravel Breeze),它运行正常,符合预期。但是,我设置了域 pro-clubs.app,当我导航到https://pro-clubs.app/login我没有看到预期的登录页面,而是看到了“404 Not Found” nginx 错误。
我正在使用 Amazon Lightsail,它使用 Bitnami 为 AWS Cloud 打包的 NGINX 开源版本https://docs.bitnami.com/aws/infrastructure/nginx/
我似乎有四个适用于此应用程序的服务器块,如下所示
https-proclubs-https-server-block.conf
https-proclubs-server-block.conf
proclubs-https-server-block.conf
proclubs-server-block.conf
由于某种原因,这两个https-proclubs-https-server-block.conf
都是https-proclubs-server-block.conf
空文件,但是后两个都包含以下内容:
proclubs-https-服务器-block.conf
server {
# Port to listen on, can also be set in IP:PORT format
listen 443 ssl default_server;
root /opt/bitnami/projects/proclubs/public;
# Catch-all server block
# See: https://nginx.org/en/docs/http/server_names.html#miscellaneous_names
server_name pro-clubs.app www.pro-clubs.app;
ssl_certificate /opt/bitnami/nginx/conf/pro-clubs.app.crt;
ssl_certificate_key /opt/bitnami/nginx/conf/pro-clubs.app.key;
include "/opt/bitnami/nginx/conf/bitnami/*.conf";
}
proclubs-服务器阻止.conf
server {
# Port to listen on, can also be set in IP:PORT format
listen 80 default_server;
root /opt/bitnami/projects/proclubs/public;
index index.php index.html;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /\.(?!well-known).* {
deny all;
}
# Catch-all server block
# See: https://nginx.org/en/docs/http/server_names.html#miscellaneous_names
server_name pro-clubs.app www.pro-clubs.app;
ssl_certificate /opt/bitnami/nginx/conf/pro-clubs.app.crt;
ssl_certificate_key /opt/bitnami/nginx/conf/pro-clubs.app.key;
include "/opt/bitnami/nginx/conf/bitnami/*.conf";
}
我应该做哪些更改才能使我的应用程序路由在使用 SSL 域时正常工作https://pro-clubs.app/dashboard例如
预期结果:
当导航至https://pro-clubs.app/login我看到了 Laravel 登录页面
实际结果:
当导航至https://pro-clubs.app/login我看到“404 Not Found”nginx 错误
答案1
新手错误。由于某种原因,以下几行出现在一个conf中,但没有出现在https中。添加了这些,现在似乎可以正常工作了
index index.php index.html;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /\.(?!well-known).* {
deny all;
}