server {
listen 28080;
# 项目域名
server_name localhost;
location / {
autoindex on;
# 项目目录
root /home/web/php/php-template/;
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
# 项目目录
root /home/web/php/php-template/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
rewrite ^/api/ajax\/([a-zA-Z_\-]+)$ /ajax.php?action=$1 last;
rewrite ^/api/fetch\/([a-zA-Z_\-\/]+)$ /ajax.php?action=$1 last;
}