我正在设置一个在vestaCP+NGINX+php-fpm 和 laravel 后端上运行的新服务器,在安装letsencrypt 后,我在除主页外的所有路由器上都遇到404 错误。laravel .env 没问题,我的 nginx 配置如下,另外,控制面板还为 ssl 创建了另一个 nginx 配置文件。该站点在 http 协议上没有任何问题。
server {
listen xx.xxx.xxx.xx:443;
server_name example.com www.example.com;
root /home/admin/web/example.com/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/example.com.log combined;
access_log /var/log/nginx/domains/example.com.bytes bytes;
error_log /var/log/nginx/domains/example.com.error.log error;
ssl on;
ssl_certificate /home/admin/conf/web/ssl.example.com.pem;
ssl_certificate_key /home/admin/conf/web/ssl.example.com.key;
location / {
try_files $uri $uri/ /index.php$is_args$args;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias /home/admin/web/example.com/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias /home/admin/web/example.com/stats/;
include /home/admin/conf/web/example.com.auth*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include /home/admin/conf/web/nginx.example.com.conf*;
}