nginx配置

# 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;
    }
}

Comments

No comments yet. Why don’t you start the discussion?

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注