# h5.uu89.com
server {
    listen 80;
    server_name h5.uu89.com n5.89yoo.com;
    index index.php;
    root /www/gaore/h5.uu89.com/public;

    access_log  /var/log/nginx/h5.uu89.com.access.log  main;
    error_log  /var/log/nginx/h5.uu89.com.error.log  warn;
    
    location / {
        try_files $uri $uri/ @rewrite;
    }

    location @rewrite {
       #set $request_path $uri;
       rewrite ^/(.*)$ /index.php?_url=/$1;
    }  

    location ~ \.php(.*)$ {
        # 只允许 index.php 直接执行
        if ($uri != "/index.php") {
            rewrite ^/(.*)$ /index.php?_url=/$1 last;
        }
        
        # 防止伪造 PHP 文件请求
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }
        
        fastcgi_pass   host.docker.internal:9070;
        fastcgi_index  index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO $fastcgi_path_info;
        # fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
        fastcgi_param  QUAN_DEBUG  On;
        fastcgi_param  GAORE_ENVIRONMENT  development;
        include        fastcgi_params;

        # 添加调试头（临时）
        add_header X-Phalcon-Debug "PHP processed" always;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
       deny  all;
    }
}