之前发的太拉胯了, 重新写了一份.
针对后台文件夹更名后, 用try_files判断,免去写白名单验证了, 官方爱咋折腾出了问题再说了.
CUSTOMADMINPATH为匹配后台自定义admin目录
location ~ [^/]\.php(/|$) { YOUR php-fpm configure in HERE }
location ~ ^/{ try_files $uri $uri/ /index.php?rp=$uri; }
location ~ ^/(admin|CUSTOMADMINPATH_1|CUSTOMADMINPATH_2)/ { try_files $uri $uri/ index.php?rp=$uri; }
原始的弃用了:
location ~ /templates/.*\.tpl$ { return 404; }
location ^~ /vendor/ { return 404; }
location ~ ^/(images/em|invoice|login|password|account|store|download|knowledgebase|announcements|clientarea/ssl-certificates|user/(verification|accounts|profile|password|security|verify)|cart/(domain/renew)|domain/pricing|cart/order|images/kb)/?(.*)$ { rewrite (.*) /index.php?rp=$uri last; }
location ~ ^/(.*)/(client|client!\.php|client/(.*)|table/(.*)|search!\.php|search/(.*)|apps|billing|setup|user|services|addons|domains|utilitiesemailmarketer!\.php|utilities/(.*)|logs|help!\.php|help/license|modules|image/(recent|upload)|validation_com/(.*))/?(.*)$ { try_files $uri $uri/ /$1/index.php?rp=$uri; }
如果whmcs放在二级目录下则小改一下.
把uri改成rewrite 的正则匹配.
本文固定链接[重写]whmcs nginx rewrite规则,你还可以查看Linux目录下的所有文章, 转载请声明文章来自Kvm.la。