server
{
    listen 80;
    server_name 101.200.165.56;
    index index.php index.html index.htm default.php default.htm default.html;

    # IP 站点 root 指向 developSite，zhctprompt 通过 /zhctprompt/ alias 访问。
    root /workspace/developSite;

    #CERT-APPLY-CHECK--START
    include /www/server/panel/vhost/nginx/well-known/101.200.165.56.conf;
    #CERT-APPLY-CHECK--END

    #SSL-START
    #error_page 404/404.html;
    #SSL-END

    #ERROR-PAGE-START
    error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END

    #PHP-INFO-START
    include enable-php-00.conf;
    #PHP-INFO-END

    #REWRITE-START
    include /www/server/panel/vhost/rewrite/101.200.165.56.conf;
    #REWRITE-END

    location = /zhctprompt {
        return 301 /zhctprompt/;
    }

    # Markdown 原文读取入口。
    location ^~ /raw-files/zhctprompt/ {
        alias /workspace/developSite/zhctprompt/;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
        charset utf-8;
        types { }
        default_type text/plain;
    }

    # Markdown 渲染器。
    location = /__mdview/index.html {
        alias /workspace/developSite/zhctprompt/docker/config/nginx/conf/mdview/index.html;
        default_type text/html;
        charset utf-8;
        add_header Cache-Control "no-store";
    }

    # 禁止访问敏感文件和目录。
    location ~* ^/zhctprompt/(.*\/)?(\.git|\.svn|\.idea|\.vscode|\.env|\.user\.ini|\.htaccess) {
        return 404;
    }

    location ~* ^/zhctprompt/.*\.(pem|key|sql|bak)$ {
        return 404;
    }

    # zhctprompt 下所有 Markdown 走渲染器。
    location ~* ^/zhctprompt/.*\.md$ {
        rewrite ^ /__mdview/index.html last;
    }

    # operation-manuals 目录展示目录结构，不自动打开 index.html。
    location /zhctprompt/operation-manuals/ {
        alias /workspace/developSite/zhctprompt/operation-manuals/;
        index __disable_index__;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
        charset utf-8;
        default_type application/octet-stream;
    }

    # zhctprompt 整体目录浏览；必须禁用 index.html，否则宝塔默认页会覆盖目录列表。
    location /zhctprompt/ {
        alias /workspace/developSite/zhctprompt/;
        index __disable_index__;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
        charset utf-8;
        default_type application/octet-stream;
    }

    # 宝塔默认禁止项：这里去掉 README.md，否则会影响文档访问。
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE)
    {
        return 404;
    }

    location ~ \.well-known{
        allow all;
    }

    if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
        return 403;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires 30d;
        error_log /dev/null;
        access_log /dev/null;
    }

    location ~ .*\.(js|css)?$
    {
        expires 12h;
        error_log /dev/null;
        access_log /dev/null;
    }

    access_log  /www/wwwlogs/101.200.165.56.log;
    error_log  /www/wwwlogs/101.200.165.56.error.log;
}
