How to Enable Wildcard Domain Vhost in Nginx and Apache – CWP/Centos

by Sandeep B.

In this tutorial we’ll learn and create wildcard vhost for Nginx and Apache under CWP Control web panel. I’ve created wildcard templates for this two webservers as a proxy for nginx which is in-front of Apache i.e. Apache is still the main backend webserver.

Wildcard vhosts is useful in situation like when you’re using WP Multisite like application or your own multisite CMS.

Before you start and use this wildcard templates ensure you’ve wildcard DNS is setup i.e. * here “*” is the wildcard DNS Name. eg. :

I’ve added this nginx wildcard proxy templates they are listed below :

wildcard-force-https-http2.stpl  wildcard-force-https.stpl  wildcard-http2.stpl  wildcard.stpl
wildcard-force-https-http2.tpl   wildcard-force-https.tpl   wildcard-http2.tpl   wildcard.tpl

and Apache wildcard template with php-cgi and php-fpm

Now lets get this templates downloaded to your server

Step 1 :

cd /usr/local/cwpsrv/htdocs/resources/conf/web_servers/

Done wildcard templates are downloaded to the template location.

Step 2 :

Setup domain to use wildcard configuration and template :

Navigate to CWP.admin >> Webservers Settings >>> Webservers Domain conf >>>> Choose User  from drop down and domain name and hit Create Configuration button

  • Now select Webserver combination i.e. nginx + apache + php-fpm/php-cgi or nginx + varnish + apache + php-fpm/php-cgi *** if you didn’t installed nginx then you only need to select for Apache.
  • Next choose wildcard template listed in dropdown under option “Nginx default vhost template” and “Apache default vhost template
  • Choose desired php verison and Check the boxRebuild WebServers conf for domain on save” then click “Save changes

That’s it you’ve configured wildcard domain/subdomain under cwp panel.

If this post helps you in any way please consider a donation

Donate with PayPal :


You may also like


John December 23, 2020 - 4:01 am

Is this already implemented in cwp by default or I still need to follow the above procedure as a have a wildcard ssl for my site with multple subdomains,?

Sandeep B. December 24, 2020 - 5:46 am

Its exclusively for blog visitors. In cwp it is not there at the moment.

Alberto December 29, 2020 - 10:18 pm

Hi Sandeep,
Is not supposed the wildcard certificate to be automatically installed? Do I need to reboot CWP first?
I followed your instructions and still see the default certificate, with classic subdomains (mail, ftp, cpanel, etc) under WebServer Settings -> SSL Certificates -> Install from Server.
Advise please.
Thanks and Happy New Year

Sandeep B. December 30, 2020 - 7:08 am

hi i didn’t mentioned anywhere that it will issue wildcard ssl certs you can use this tutorial to get free wildcard LE ssl : or you can buy one from CA provider.

happy new year to you too.

Yassine March 1, 2021 - 12:57 am

You tried it, but it didn’t work?

Sandeep B. March 1, 2021 - 5:40 pm

hi probably you forget to choose the template or DNS is not created,

Yassine March 28, 2021 - 11:38 pm

Is there a way to contact you, I will pay you to set up the order. Configure a wildcard with an SSL certificate, is it possible?

Sandeep B. March 29, 2021 - 3:20 am

you can contact me via forum
support portal :

Yassine March 29, 2021 - 1:53 pm

You have opened a new ticket to contact you


Leave a Comment