如题问题,maccms搭建好了,但是进入后台遇到重定向次数过多的问题。
其实maccms官方已经给出了解决方案,如下。
iis6.x 下使用 httpd.ini
iis7.x 下使用web.config
我用的阿里云服务器,用的是nginx,所以把在主机.conf设置里加上 include xxxxx.conf
或者加上如下内容:
if (!-e $request_filename) { rewrite ^/index.php(.*)$ /index.php?s=$1 last; rewrite ^/admin.php(.*)$ /admin.php?s=$1 last; rewrite ^/api.php(.*)$ /api.php?s=$1 last; rewrite ^(.*)$ /index.php?s=$1 last; break; }
完整conf举例:
server {
listen 80;
server_name yy.xx2018.cn;
access_log /data/wwwlogs/yy.xx2018.cn_nginx.log combined;
index index.html index.htm index.php;
include /usr/local/nginx/conf/rewrite/none.conf;
root /data/wwwroot/default/maccms;
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^/admin.php(.*)$ /admin.php?s=$1 last;
rewrite ^/api.php(.*)$ /api.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
#error_page 404 = /404.html;
#error_page 502 = /502.html;
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /\.ht {
deny all;
}
}
修改完了conf之后,一定要重启nginx,否则是不会生效的。
service nginx restart
好了,问题已经成功解决了。
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/203285.html原文链接:https://javaforall.net
