centos web panel – vhost templates for proxying websocket traffic

http://wiki.centos-webpanel.com/webservers-vhost-templates

Templates location: /usr/local/cwpsrv/htdocs/resources/conf/web_servers/
– Folder main contains main configuration for WebServers
– Folder vhosts contains vhosts configuration for domains (this is what you need)

How to create a template file
The easiest way to do that is to simply copy an existing file and then edit a new file you have created.
Note that you need to have .tpl and .stpl files (tpl is for http and stpl is for https version)

Let’s do one example for apache vhost with nginx

cd /usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts/nginx/
cp default.tpl my-template.tpl
cp default.stpl my-template.stpl

Now you can edit these newly created template files.

Template folders explained
List from folder: /usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts/

httpd = apache templates
nginx = nginx templates
varnish = varnish templates
php-fpm = php-fpm service templates (used for all php-fpm versions)

add a block

map $http_upgrade $connection_upgrade {
	default upgrade;
	'' close;
}

also add these inside “location /” block

		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection $connection_upgrade;
		proxy_set_header Host $host;