nginx_tp6_conf.md 827 B


title: "Nginx_tp6_conf" date: 2024-01-04T14:27:01+07:00

draft: false

nginx config with thinkPHP6.x

根據自己的系統做相應調整


server {
    listen 80;
    server_name _.com;
    root  /home/web/tproot/public;
    access_log /var/log/access.log;
    error_log  /var/log/error.log;
    
    location / {
        index index.php index.html index.htm;
        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php?s=/$1 last;
            break;
        }
    }

    location ~ .*\.(html|txt|sql|log)$ {
        return 403;
    }

    location ~ \.php$ {
        index index.php;
        fastcgi_pass  unix:/tmp/php-cgi.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}