How to run a Linux website with both http and https protocol

Question: How to run a Linux website with both http and https protocol ?
Answer:

It is not possible to create the Linux website with both http and https protocol through HC panel. You have to perform some manual steps to run the Linux website with both ‘http’ and ‘https’ protocol:

  • Run the following command to check ServerRoot path

$ apachectl –V 

and then check the output for "-D HTTPD_ROOT" directive. e.g

-D HTTPD_ROOT="/etc/apache2" (for Debian/Ubuntu)

-D HTTPD_ROOT="/etc/httpd" (for CentOS, Fedora,RHE)

  • Create a file e.g domain-name.conf in the same ServerRoot directory (/etc/apache2 Or /etc/httpd)
  •  Copy <VirtualHost> tag of the desired website from apache configuration file and paste it in domain-name.conf  file, change the port for that website from :443 to :80 in Virtualhost tag and also delete the lines containing the following directives:

    SSLEngine on
    SSLCertificateFile/etc/ssl/hc/yourdomain.com/yourdomain.com.crt
    SSLCertificateKeyFile /etc/ssl/hc/yourdomain.com/yourdomain.com.key
  • Add following line in apache configuration file
    include domain-name.conf 
    Restart apache service and now site will run with both http and https protocol

Add Feedback