server {
charset utf-8;
listen 80; ## 配置一个端口号
server_name admin.boost-tutorial.local; ## 配置一个本地的域名 并且在c盘的host文件下添加映射关系 127.0.0.1 admin.boost-tutorial.local
root C:\Users\dell\Desktop\innobase.tech\boost-tutorial\web-frontend\backend-server\web; ## 配置项目的Web目录
index index.php;
access_log D:/phpStudy/nginx-1.19.2/logs/access.log; ## 打印log日志路径
error_log D:/phpStudy/nginx-1.19.2/logs/error.log; ## 打印log日志路径
location /api {
index index.html index.htm index.php;
if (!-e $request_filename){
rewrite ^/(.*)$ /api/index.php/$1 last;
}
}
location ~ \.php(.*)$ {
root C:\Users\dell\Desktop\innobase.tech\boost-tutorial\web-frontend\backend-server\web; // 项目路径
fastcgi_pass 127.0.0.1:9001; // php cgi监听端口
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
location ~ /\.(ht|svn|git) {
deny all;
}
}