8

[重写]whmcs nginx rewrite规则

 11 months ago
source link: https://vpsxb.net/4664/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[重写]whmcs nginx rewrite规则

> linux > [重写]whmcs nginx rewrite规则
202206191902179.png

之前发的太拉胯了, 重新写了一份.

202306241755111.png

针对后台文件夹更名后, 用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 


VPS小白 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK