我知道这个问题已经讨论了很多次,但是没有其他话题可以解决我的问题。我在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"