Virtual Host & Certificate
How to enable site with apache2 and a template for socket.io nginx server.
Last updated
How to enable site with apache2 and a template for socket.io nginx server.
Last updated
refer to:
An example of creating a virtual host for domain example.happenn.com with SSL.
Assuming that the root directory of the project is at /var/www/example.happenn.com and certificate files has been locate to /root/ssl/example.happenn.com.
SSH to the server and go to /etc/apache2/sites-available. Then create a file name example.happenn.com.conf (File name can be anything but using the domain's name is more prefer.
The first group is for handling HTTPS and another group is handle redirect from HTTP. Do not forget to change the ServerAdmin email to yours. Then you need to enable the site (this conf file) and restart the apache2 service.
To handle a different domain name, just change anything that has example.happenn.com to the domain you want.
If there is an error, mostly due to syntax error or unable to locate SSL files. If it is the new server, check if the SSL module is enable.
As we are not using nginx for anything except for socket.io due to upgrade issue configuration on apache2. There is not reason to modify or anything.
Similar to apache2, this setup redirect on HTTP and redirect to HTTPS. snippets/ssl- is for certificates. Whereas location configs are focusing on upgrade http header to make ws and wss protocols work. As the node.js run as its own serve, the port cannot be 80 or 443 (in this case, 3000).