Let's Encrypt 入门教程(附配置代码)
https://bitmingw.com/2017/02/02/letsencrypt-tutorial/
点击查看代码
server {
listen 443 ssl;
server_name blog.ihibin.cn;
root /home/hugh/wordpress;
index index.html index.htm index.nginx-debian.html index.php;
ssl_certificate /etc/letsencrypt/live/blog.ihibin.cn/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/blog.ihibin.cn/privkey.pem;
location / {
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php;
}
if (!-f $request_filename) {
rewrite (.*) /index.php;
}
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php8.0-fpm.sock;
# With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
}
}