Jump to content

WHMCS NGINX Rewrite Rules for Version 8.1.3


JayV

Recommended Posts

My friend Bala gave me a hand with these rules for nginx.

  #== WHMCS Security Advisory 2020-01-28
  location ^~ /whmcs/vendor/ {
    deny all;
    return 403;
  }
  #== WHMCS Admin Area
  location ~ /whmcs/admin/(client!\.php|client/(.*)|search!\.php|search/(.*)|apps|billing|setup|user|services|addons|domains|utilities|logs|help!\.php|help/license|image/(recent|upload))/?(.*)$ {
    root /path/to/website/root/folder;
    rewrite ^/(.*)$ /whmcs/admin/index.php?rp=/admin/$1/$2;
  }
  #== WHMCS Client Area
  location ~ /whmcs/(images/em|invoice|login|password|account|store|download|knowledgebase|project_management|announcements|clientarea/ssl-certificates|user/(verification|accounts|profile|password|security|verify)|cart/(domain/renew)|cart/order|images/kb)/?(.*)$ {
    root /path/to/website/root/folder;
    rewrite ^/(.*)$ /whmcs/index.php?rp=/$1/$2;
  }

Finish the task by completing the following:

1.  Log in to your WHMCS Admin
2.  Go to Configuration > General and change your "Friendly URLs" to "Full Friendly Rewrite"
3.  Go to Utilities > System > System Cleanup > Empty Template Cache
4.  Clear your cache at /var/cache/nginx/*
5.  Test Nginx with "nginx -t"
6.  Reload Nginx with "nginx -s reload"  

I hope this helps someone.

Cheers!



 

Edited by JayV
Link to comment
Share on other sites

  • 11 months later...
  • 3 months later...
  • 1 year later...

I've dug into this subject, with a little help from here: 


Just in case more people search for this, I have also updated and provided a "vanilla" list of the nginx rules required here: https://gist.github.com/xyzulu/dbe2762c131b7bf3fbfc67056a565ae0

It would be good for WHMCS to support Nginx better.. a simple list of these rules in the documentation would be enough.. but anyway. 

Link to comment
Share on other sites

On 7/12/2023 at 12:20 AM, xyzulu said:

I've dug into this subject, with a little help from here: 


Just in case more people search for this, I have also updated and provided a "vanilla" list of the nginx rules required here: https://gist.github.com/xyzulu/dbe2762c131b7bf3fbfc67056a565ae0

It would be good for WHMCS to support Nginx better.. a simple list of these rules in the documentation would be enough.. but anyway. 

Hey, thanks for that.

How would you edit this if your WHMCS installation resides in public html, and not in client or any folder sub folder.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated