We're Hiring!

Mattermost Discussion Forums

Apache2 reverse proxy on a server with cpanel

Hey there, I am trying to install mattermost on a subdomain of our organization’s site, It’s working really fine at ip:8065 but I am getting errors while deploying it at a subdomain.

When I use following proxy config at the location
/etc/apache2/conf.d/userdata/std/2_4/CPANEL_USER/SUBDOMAIN/config.conf

Apache2 Config
<VirtualHost *:443>
  ServerName subdomain.domain.com
  ServerAdmin hostmaster@mydomain.com
  ProxyPreserveHost On

                  # Set web sockets
  RewriteEngine On
  RewriteCond %{REQUEST_URI} /api/v[0-9]+/(users/)?websocket [NC,OR]
  RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
  RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
  RewriteRule .* ws://127.0.0.1:8065%{REQUEST_URI} [P,QSA,L]

 <Location />
  Require all granted
  ProxyPass http://127.0.0.1:8065/
  ProxyPassReverse http://127.0.0.1:8065/
#  ProxyPassReverseCookieDomain 127.0.0.1 mysubdomain.mydomain.com
 </Location>

and then when I try to build the config file using $ /scripts/rebuildhttpdconf it give the following error.

Error
$ /scripts/rebuildhttpdconf
Initial configuration generation failed with the following message:
The “/usr/sbin/httpd -DSSL -t -f /etc/apache2/conf/httpd.conf.work.932c9002.cfgcheck -C Include "/etc/apache2/conf.modules.d/*.conf"” command (process 15193) reported error number 1 when it ended.
Configuration problem detected on line 0 of file /etc/apache2/conf.d/userdata/std/2_4/gramoly/staff.gramoly.org/proxy.conf: <VirtualHost> cannot occur within <VirtualHost> section


Rebuilding configuration without any local modifications.

Failed to generate a syntactically correct Apache configuration.Bad configuration file located at /etc/apache2/conf/httpd.conf.work.932c9002
Error:The “/usr/sbin/httpd -DSSL -t -f /etc/apache2/conf/httpd.conf.work.932c9002.cfgcheck -C Include "/etc/apache2/conf.modules.d/*.conf"” command (process 15194) reported error number 1 when it ended.
Configuration problem detected on line 0 of file /etc/apache2/conf.d/userdata/std/2_4/gramoly/staff.gramoly.org/proxy.conf: <VirtualHost> cannot occur within <VirtualHost> section