在Windows系统上配置Nginx环境运行PBootCMS时,如果访问首页直接出现404错误,可以按照以下步骤进行排查和解决:
1. 检查Nginx配置文件
确保Nginx的配置文件正确无误。通常配置文件位于conf/nginx.conf
或conf/sites-available/default
。
server {
listen 80;
server_name localhost;
root D:/path/to/pbootcms; # 替换为PBootCMS的实际路径
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000; # 确保PHP-FPM监听的端口正确
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}