Vhost Templates

CloudPanel v1 is obsolete

CloudPanel v1 is obsolete; check out the CloudPanel v2 Docs.

Application

The right Vhost Template for your Application is essential. For managing the CloudPanel Vhost Templates we are using GitHub. Vhost Templates for all popular PHP Applications can be found there.

Adding an Application

The Vhost Templates are organized within Applications. The Vhost Template for newer application versions may be different than for an older one.

To add a new Application do the following steps:

1) Login into the CloudPanel as User with admin rights.

2) Go to the Admin Area by clicking on Admin Area top right.

3) In the left menu, click on Vhost Templates and click on the button Add Application.



Enter the Application Name and click on the button Add New Application to save.

Deleting an Application

On the Vhost Templates overview site, you can delete an Application by clicking on the button Delete.

Vhost Template

Adding a Vhost Template

To add a new Vhost Template to an Application, click on the Application and then on the button Add Vhost Template.



Enter the Template Name and content of the Vhost Template and click on Add Vhost Template.

The following placeholders are required:

  • {{ssl_certificate_key}}
  • {{ssl_certificate}}
  • {{root}}
  • {{nginx_access_log}}
  • {{nginx_error_log}}
  • {{basic_auth}}
  • {{php_fpm_listener}}
  • {{php_settings}}


You can use the Vhost Template below and modify it to your needs.

server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
{{ssl_certificate_key}}
{{ssl_certificate}}
{{server_name}}
{{root}}
{{nginx_access_log}}
{{nginx_error_log}}
if ($bad_bot = 1) {
return 403;
}
if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
}
location ~ /.well-known {
auth_basic off;
allow all;
}
{{basic_auth}}
try_files $uri $uri/ /index.php?$args;
index index.php index.html;
location ~ \.php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files $uri =404;
fastcgi_read_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_param HTTPS $fastcgi_https;
{{php_fpm_listener}}
{{php_settings}}
}
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm|webp|zip|swf)$ {
add_header Access-Control-Allow-Origin "*";
expires max;
access_log off;
}
if (-f $request_filename) {
break;
}
}

Deleting a Vhost Template

To delete a Vhost Template, click on the Application and then on the button Delete.



Vhost Templates

Updating Vhost Templates

All Vhost Templates are managed via GitHub, where we make constantly changes.

To update the Vhost Templates in your CloudPanel do the following:

1) Login via SSH to your server and become root.

sudo su root

2) Run the following command:

clpctl vhost-templates:import