0
时,服务器显示404将不胜感激。当使用https [nginx]
我已经收到了letsencrypt的SSL证书,并且正在尝试为我的服务器同时支持HTTP和HTTPS。该证书是好的,但当我试图使用https访问我的网站时,我收到了404的证书。这里是我的配置文件:
server {
server_name my.domain.org;
root /var/www/my.domain.org/htdocs;
index index.php index.html index.html;
server_name my.domain.org;
location/{
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location = /favicon.ico {
access_log off;
log_not_found off;
}
location = /robots.txt {
access_log off;
log_not_found off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
server {
listen 443;
ssl on;
ssl_certificate /etc/letsencrypt/live/my.domain.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/my.domain.org/privkey.pem;
server_name my.domain.org;
access_log /var/log/nginx/nginx.vhost.access.log;
error_log /var/log/nginx/nginx.vhost.error.log;
location/{
root /var/www/my.domain.org/htdocs;
index index.php index.html index.html;
}
}
谢谢你,我很欣赏这一点。还有一个问题需要澄清,你在这里粘贴的是我的整个配置文件? (忽略其他服务器{}块)或者这只会替换我现在用于SSL的块? – nginthrowaway
@nginthrowaway我已经更新了我的答案您可以复制全部 – num8er
像魅力一样工作,非常感谢! – nginthrowaway