Skip to content

Instantly share code, notes, and snippets.

@xyzulu
Forked from Bharat-B/readydedis.com.conf
Last active July 20, 2025 09:57
Show Gist options
  • Save xyzulu/dbe2762c131b7bf3fbfc67056a565ae0 to your computer and use it in GitHub Desktop.
Save xyzulu/dbe2762c131b7bf3fbfc67056a565ae0 to your computer and use it in GitHub Desktop.
nGINX rewrite rules for whmcs 8
location ~ /clients/admin/(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/(.*))/?(.*)$ {
rewrite ^/(.*)$ /clients/admin/index.php?rp=/admin/$1/$2;
}
location ~ /clients/(images/em|invoice|domain|login|invite|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 ^/(.*)$ /clients/index.php?rp=/$1/$2;
}
location ~ /clients/auth/manage/client/links/?(.*)$ {
rewrite ^/(.*)$ /clients/index.php?rp=/auth/manage/client/links$1;
}
location ^~ /clients/vendor/ {
deny all;
return 403;
}
@xyzulu
Copy link
Author

xyzulu commented Jun 8, 2025

Please guide me the best approach to use whmcs in vps.

Perhaps you should be contacting WHMCS for this kind of help.

@RoJackal
Copy link

This is my WHMCS block for nginx , tested on WHMCS 8.13.1 (replace /billing with the name of your whmcs folder).
WHMCS support send me to this gist, as always the answer is "we do not support nginx and we have no documentation for it".

location ^~ /billing/vendor/ { deny all; return 403; }
location ^~ /billing/assets/ { try_files $uri $uri/ =404; }
location ^~ /billing/templates/ { try_files $uri $uri/ =404; }
location ^~ /billing/images/ { try_files $uri $uri/ =404; }
location ~ ^/billing/modules {
    try_files $uri $uri/ =404;
    include nginxconfig.io/php_fastcgi.conf;
    fastcgi_pass unix:/var/opt/remi/php83/run/php-fpm/highproxies.sock;
}
# This is your universal catch-all for friendly URLs
location /billing/ {
    try_files $uri $uri/ /billing/index.php?$query_string;
}
# Admin area rewrite (for REST-style URLs)
location ~ ^/billing/admin/(client!\.php|client/.*|table/.*|search!\.php|search/.*|apps|billing|setup|user|services|addons|account/.*|domains|utilitiesemailmarketer!\.php|utilities/.*|logs|help!\.php|help/license|modules|image/(recent|upload)|validation_com/.*)/?(.*)$ {
    rewrite ^/.*$ /billing/admin/index.php?rp=/admin/$1/$2 last;
}
# Client area friendly URLs
location ~ ^/billing/(invite|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|paypal_acdc|paypal_ppcpv|paypal|cryptomusgateway)/?(.*)$ {
    rewrite ^/.*$ /billing/index.php?rp=/$1/$2 last;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment