CentosControl PanelCWPLinuxWordpress

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

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. *.mysterydata.com. 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/
wget https://www.uxlinux.com/upload/cwp-wildcard-templates.zip
unzip cwp-wildcard-templates.zip

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.

Sandeep B.

I'm a system admin and php developer and currently working as System Admin In CWP Control panel, expertise in Linux and Windows administration RHEL certified admin.

Related Articles

10 Comments

  1. Dear
    How Are you?
    I have problems with nginx in the configuration I have this

    404 Not Found
    nginx/1.20.2

    config
    Manage WebServers Configuration >
    Select: nginx ->php-fpm

    Nginx default vhost template: > Prestashop_ssl

    PHP-FPM version: 7.4

    thank you

  2. 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?

  3. 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

  4. 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,?

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button