thinkphp能加载,但是控制台报404错误。
我的服务器是apache2.4.23(后端), nginx1.10.2(前端),部署在 OSX。
在http://localhost/blog/public/index.php/index/test/index中,能加载验证码,但是控制台报了404错误(图片1)
直接打开http://localhost/blog/public/index.php/captcha.html却没有问题(图片2)
图片1

图片2

下面是我的nginx配置
server {
listen 80;
server_name _;
location / {
root /usr/local/var/www;
index index.html index.htm index.php index;
}
error_page 404 @proxy;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8000;
}
location @proxy {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8000;
}
}
apache 监听8000端口,开启了mod_rewrite.so模块,更改了 所有AllowOverride为all。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
解决:更改所有请求到apache。