我知道这被讨论了很多次,但没有其他话题能解决我的问题。我在 ubuntu 18.04 上运行 nginx,并且我在这台机器上安装了 iRedMail。iRedMail 管理页面和roundcube 工作出色,但我正在尝试创建第二个虚拟主机来托管第二个网站,但是在启动浏览器并指向第二个域时出现 403 Forbidden 错误。
xxx.xxx.com 运行良好。xxx.com 进入 403 禁止页面。
我是菜鸟,所以如果这是一个愚蠢的错误,请不要生气。
nginx的00-default-ssl.conf
server {
listen 443;
server_name xxx.xxx.com;
root /var/www/html;
index index.php index.html;
include /etc/nginx/templates/misc.tmpl;
include /etc/nginx/templates/ssl.tmpl;
include /etc/nginx/templates/iredadmin.tmpl;
include /etc/nginx/templates/roundcube.tmpl;
include /etc/nginx/templates/sogo.tmpl;
include /etc/nginx/templates/netdata.tmpl;
include /etc/nginx/templates/php-catchall.tmpl;
include /etc/nginx/templates/stub_status.tmpl;
ssl_certificate /etc/letsencrypt/live/xxx.xxx.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/xxx.xxx.com/privkey.pem; # managed by Certbot
}
server {
listen 443;
server_name xxx.com;
root /var/www/site;
ssl_certificate /etc/letsencrypt/live/xxx.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/xxx.com/privkey.pem; # managed by Certbot
}
Nginx的错误日志:
[error] 17970#17970: *1 directory index of "/var/www/site/" is forbidden, client: 80.31.xx.xxx, server: xxx.com, request: "GET /site/ HTTP/1.1", host: "xxx.com"