chore: 从Apache迁移到Nginx服务器配置
删除原有的.htaccess文件并添加新的nginx.conf配置文件
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
# 启用URL重写引擎
|
||||
RewriteEngine On
|
||||
|
||||
# 基础目录设置
|
||||
RewriteBase /
|
||||
|
||||
# 如果请求的是一个存在的文件或目录,则不进行重写
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
|
||||
# 所有请求都重定向到index.php
|
||||
RewriteRule ^(.*)$ index.php [L]
|
||||
|
||||
# 确保查询字符串被保留
|
||||
RewriteCond %{QUERY_STRING} .+
|
||||
RewriteRule ^(.*)$ index.php?$0 [L,QSA]
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
# Nginx配置文件 - 适用于wangpu_auth API
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root c:\Users\吴展鹏\wangpu_auth;
|
||||
|
||||
# 访问日志和错误日志
|
||||
access_log logs/access.log;
|
||||
error_log logs/error.log;
|
||||
|
||||
# 将所有请求重定向到index.php
|
||||
location / {
|
||||
# 检查请求的文件或目录是否存在
|
||||
if (!-e $request_filename) {
|
||||
# 保留查询字符串,重写所有请求到index.php
|
||||
rewrite ^/(.*)$ /index.php?$args last;
|
||||
}
|
||||
}
|
||||
|
||||
# 处理PHP文件
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
|
||||
# 确保传递所有查询参数
|
||||
fastcgi_param QUERY_STRING $query_string;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user