在Certbot更改其中一个Nginx的site-conf文件后,我在两个站点上遇到了错误的网关。
在nginx -t没有任何错误。
只有这个在tail /var/log/nginx/error.log :
连接到上游时,客户端:66.249.69.71,服务器:domain.tld1,请求:“GET连接()失败(111:连接被拒绝)时发送错误消息27439#27439: / category /%D7%9B%D7%9C%D7%9C%D7%99 / HTTP / 1.1“,上行:”fastcgi://127.0.0.1:9000“,主机:”contfix.co.il“root @ benqzq:〜#
只有这个在tail /var/log/nginx/access.log :
185.188.204.5 – [24 / Oct / 2017:15:44:13 +0000]“POST /xmlrpc.php HTTP / 1.0”499 0“ – ”“Mozilla / 4.0(compatible:MSIE 7.0; Windows NT 6.0)”
这是我使用Certbot更改的站点的站点configuration:
server { root /var/www/html/contfix.co.il; server_name contfix.co.il www.contfix.co.il; location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass 127.0.0.1:9000; } location ~ /\.ht { deny all; } location ~* \.(jpg|jpeg|png|gif|ico|css|js|ttf|woff|pdf)$ { expires 365d; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/contfix.co.il/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/contfix.co.il/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot if ($scheme != "https") { return 301 https://$host$request_uri; } # managed by Certbot # Redirect non-https traffic to https # if ($scheme != "https") { # return 301 https://$host$request_uri; # } # managed by Certbot }
我没有select使用Certbot完成的第二个站点的site-conf文件保持不变。
在安装和使用Certbot之前,这两个站点都工作得很好。
我去了nginx/conf.d/ssl但那里的文件包含键,而不是用来debugging这个工作。
我应该如何进一步debugging呢?
在我的域名上使用Certbot时,我得到了错误:
Could not open file: /etc/nginx/sites-enabled/default
当我做了certbot renew --dry-run我也得到了它,但我没有得到它只是当“certbot续期”。
主要的问题是,在我的站点conf文件中出现的关于我的站点的CGI指令(负责依赖于PHP的数据处理)并不像实施SSL之后那样。
这是有效的新设置:
location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
关于与detault有关的错误,只需启用网站并删除名为default的符号链接inode即可。 因此,即使您在sites-available有默认模板,也不会被利用。