圣者2026最新版全能站群程序7折放价促销优惠!再送任意一款付费插件(自选)...
首页 资讯 程序 案例 帮助 插件 模板 社区 站长工具 供求
帮助 控制台 登录 免费注册
首页帮助中心 › 部署配置

Nginx泛域名解析与反向代理伪静态深度配置指南

Nginx 泛域名配置范例

server {
    listen 80;
    server_name *.szher.com szher.com;
    root /www/wwwroot/szher.com;
    index index.php index.html;

    # 静态资源缓存配置
    location ~* .(jpg|jpeg|gif|png|css|js|ico|woff2)$ {
        expires 30d;
        access_log off;
    }

    # 核心伪静态重写规则
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # PHP-FPM 处理
    location ~ .php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

配置保存后执行 nginx -t 确认语法无误,再执行 nginx -s reload 即可生效。