docker中,nginx配置重写循环错误
日志如下:
2017/05/23 11:44:06 [error] 5#5: *39 rewrite or internal redirection cycle while processing "/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/admin.php/public/login.html", client: 192.168.99.1, server: , request: "GET /admin.php/public/login.html HTTP/1.1", host: "192.168.99.100:81", referrer: "http://192.168.99.100:81/admin.php"
2017/05/23 11:44:06 [error] 5#5: *40 rewrite or internal redirection cycle while processing "/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/admin.php/public/login.html", client: 192.168.99.1, server: , request: "GET /admin.php/public/login.html HTTP/1.1", host: "192.168.99.100:81", referrer: "http://192.168.99.100:81/admin.php"
2017/05/23 11:45:05 [error] 5#5: *42 rewrite or internal redirection cycle while processing "/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/admin.php/public/login.html", client: 192.168.99.1, server: , request: "GET /admin.php/public/login.html HTTP/1.1", host: "192.168.99.100:81", referrer: "http://192.168.99.100:81/admin.php"
nginx配置文件如下:
#upstream php {
# server php-fpm:9000;
#}
server {
listen 80 default;
root /var/www/html/webroot/Public;
index index.php index.html;
location / {
index index.html index.htm index.php l.php;
#autoindex on;
if (!-e $request_filename) {
#重写路由,去掉前缀
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php$ {
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
这个配置文件在我之前没有使用docker构建的时候,线上环境跑起来完全没问题的。
新编排目录如下:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
粗心大意
最后还是自己解决了问题,匹配路由的问题,比如说我访问/index.php/....之前那个就有问题。