Jump to content

WHMCS with nginx


Recommended Posts

Hello guys,

I am truggling to use whmcs with nginx. I'm using a plesk server environment and I disabled the proxy mode, so nginx was running. 

I managed to do the right config for the first site on the domain, a wordpress one.

I have whmcs installed in /hosting folder on domain and I tried these:

 


    location ~ /hosting/announcements/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/announcements/$1;
    }

    location ~ /hosting/download/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/download$1;
    }

    location ~ /hosting/knowledgebase/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/knowledgebase/$1;
    }

    location ~ /hosting/store/ssl-certificates/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/store/ssl-certificates/$1;
    }

    location ~ /hosting/store/sitelock/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/store/sitelock/$1;
    }

    location ~ /hosting/store/website-builder/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/store/website-builder/$1;
    }

    location ~ /hosting/store/order/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/store/order/$1;
    }

    location ~ /hosting/cart/domain/renew/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/cart/domain/renew$1;
    }

    location ~ /hosting/account/paymentmethods/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/account/paymentmethods$1;
    }

    location ~ /hosting/password/reset/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/password/reset/$1;
    }

    location ~ /hosting/account/security/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/account/security$1;
    }

    location ~ /hosting/subscription?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=/subscription$1;
    }

#Social media authorization
    location ~ /hosting/auth/provider/google_signin/finalize/?(.*)$ {
        rewrite ^/(.*)$ /hosting/index.php?rp=auth/provider/google_signin/finalize$1;
    }

 #WHMCS ADMIN
location ~ /hosting/admin/(addons|apps|search|domains|help\/license|services|setup|utilities\/system\/php-compat)(.*) {
        rewrite ^/(.*)$ /hosting/admin/index.php?rp=/admin/$1$2 last; 
    }

    location ~ /hosting/admin/client/?(.*)/paymethods/?(.*)$ {
        rewrite ^/(.*)$ /hosting/admin/index.php?rp=/client/?(.*)/paymethods/$1;
    }

    location ~ /hosting/admin/setup/auth/?(.*)$ {
        rewrite ^/(.*)$ /hosting/admin/index.php?rp=/setup/auth/$1;
    }

    location ~ /hosting/admin/client/?(.*)/tickets/?(.*)$ {
        rewrite ^/(.*)$ /hosting/admin/index.php?rp=/client/?(.*)/tickets/$1;
    }

    location ~ /hosting/admin/client/?(.*)/invoice/?(.*)/capture/?(.*)$ {
        rewrite ^/(.*)$ /hosting/admin/index.php?rp=/client/?(.*)/invoice/?(.*)/capture/$1;
    }

    location ~ /hosting/admin/account/security/two-factor/?(.*)$ {
        rewrite ^/(.*)$ /hosting/admin/index.php?rp=/admin/account/security/two-factor/$1;
    }

    location ~ /hosting/admin/search/intellisearch?(.*)$ {
        rewrite ^/(.*)$ /hosting/admin/index.php?rp=/search/intellisearch/$1;
    }

# Security Advisory 2020-01-28
    location ^~ /vendor/ {
        deny all;
        return 403;
    }
# END WHMCS CONFIG

It's not working, it get an error that it cannot connect to the database.

The connection details are ok because when I use it with apache it works.

 

Is there anybody that managed to make whmcs work with nginx?

I want to do this switch because nginx is way faster.

Link to comment
Share on other sites

Hey! Yes I have managed to get it to work with nginx, I suspect that you followed this tutorial? https://hostup.org/blog/whmcs-friendly-urls-configuration-for-nginx/. Well, I actually wrote it with some help of others.

 

Anyways, I haven't tried it with plesk, only on actual linux nginx on ubuntu and debian. It is strange that you are getting database connection errors as it shouldn't touch that part? I would recommend doing it like I have done on my whmcs installation.

1. https://hostup.org/blog/how-to-install-nginx-and-php-7-3-on-debian-10/

2. install whmcs

3. follow the above whmcs friendly urls configuration for nginx.

Edited by Villavu
Link to comment
Share on other sites

  • 2 years later...

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