• Before reaching in order to configure HTTPS in Apache2, we can setup an VPS running on Linux. Like the example, VEESP is one of affordable VPS price to implement.
• The next step, install apache2 will take so long if you are a newbie. Hence, let refere available resource to overcome the step. Using the syntax as below to determine if Apache is installed on a system?
dpkg --get-selections | grep apache
• Go to etc/apache2/certs and you can see apache2-selfsigned.crt and apache-selfsigned.key in the certs and private folder.
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
• Using the /etc/hosts file for custom domains during development.
root@chatbox:/etc# cat hosts
# Generated by SolusVM
127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain
185.242.107.227 flagtickgroup.com
root@chatbox:/etc#
• Upon successfully change /etc/hosts and clone 000-default.conf into new file named flagtickgroup.com.conf.
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
ServerName flagtickgroup.com
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ServerAlias www.flagtickgroup.com
DocumentRoot /var/www/chatbox
ServerName flagtickgroup.com
Redirect / https://flagtickgroup.com
<Directory "/var/www/chatbox">
AllowOverride All
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
<VirtualHost *:443>
ServerName flagtickgroup.com
DocumentRoot /var/www/chatbox
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
• Check the website if it is using SSL using CURL on Linux
* Trying 172.67.195.65:443...
* Connected to flagtickgroup.com (172.67.195.65) port 443 (#0)
* schannel: disabled automatic use of client certificate
* ALPN: offers http/1.1
* ALPN: server accepted http/1.1
> GET / HTTP/1.1
> Host: flagtickgroup.com
> User-Agent: curl/7.83.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Thu, 23 Feb 2023 07:11:48 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: Express
< Access-Control-Allow-Origin: *
< Via: 1.1 flagtickgroup.com (Apache/2.4.41)
< CF-Cache-Status: DYNAMIC
< Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com"}],"group":"cf-nel","max_age":604800}
< NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< Server: cloudflare
< CF-RAY: 79de2645cb4004b7-HKG
< alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
<
<h1>Your server has start from deployment!!</h1>* Connection #0 to host flagtickgroup.com left intact
• To active SSL in apache2, you will run the following command:
sudo a2enmod ssl && sudo service apache2 restart
In opposite, you can disable ssl in apache2.
sudo a2dismod ssl && sudo service apache2 restart
• If you integrate CDN at middle layer and normally encounter issue as below:
How to resolve issue? The problem aim at Cloudflare if SSL/TLS has wrong configuration. How to resolve issue? The problem aim at Cloudflare if SSL/TLS has wrong configuration. Navigate to DNS/Records and observe configured for custom domain flagtickgroup.com.
• Go to SSL/TLS and select option. If option is Full and SSL activated between Website Browser and Website Server.
• Notice that you need to remove /sites-enable/flagtickgroup.com.conf to remove cache after change options in SSL/TLS.
• Examine website is running on SSL or non-SSL.
curl --verbose https://ebigmall.com
or
curl --verbose http://ebigmall.com