# HTTP 强制跳转 HTTPS(通用配置)
server {
listen 80;
server_name ow.gqcraft.top gqcraft.top;
return 301 https://$host$request_uri;
}
# HTTPS 主配置
server {
listen 443 ssl;
server_name ow.gqcraft.top gqcraft.top;
root /var/www/html/wordpress;
index index.php index.html index.htm;
# SSL 证书路径(Certbot 自动配置)
# WordPress 规则
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Posted in功能分类