UBUNTU DUMP‎ > ‎

Ubuntu Apache install / https

posted 17 Mar 2016, 14:04 by DR Labs   [ updated 28 Aug 2017, 07:20 by Donald Ross ]
Install Apache
sudo apt-get update
sudo apt-get install apache2

Install HTTPS
sudo a2enmod ssl
sudo service apache2 restart

sudo mkdir /etc/apache2/ssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
The key and certificate will be created and placed in your /etc/apache2/ssl directory.
sudo nano /etc/apache2/sites-available/default-ssl.conf
add the following #
  <VirtualHost _default_:443>

       # ServerName your_domain.com
       # ServerAlias www.your_domain.com
        SSLEngine on
       # SSLCertificateFile /etc/apache2/ssl/apache.crt
       # SSLCertificateKeyFile /etc/apache2/ssl/apache.key
now enable ssl
sudo a2ensite default-ssl.conf
sudo service apache2 restart

referance
https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04


Additional info for lab setup
change document root in both these files

/etc/apache2/sites-available/default-ssl.conf
DocumentRoot /var/www/html/lab443

/etc/apache2/sites-available/000-default.conf
DocumentRoot /var/www/html/lab80
create
mkdir /var/www/html/lab443
mkdir /var/www/html/lab80

nano /var/www/html/lab443/index.html
nano /var/www/html/lab80/index.html

sudo service apache2 restart

HTTP
create
mkdir /var/www/html/lab443
mkdir /var/www/html/lab80

nano /var/www/html/lab80/index.html
add the following
<!DOCTYPE html>
<html>
<head>
<title>DDRcomputing</title>

</head>
<body>
<body style="background-color:blue;">
<h1 style="font-size:500%;" style="text-align:center;">LAB OR DIE</h1>
<p style="font-size:300%;" style="text-align:center;">this web server is running on port 80 unencrypted</p>
<p style="font-size:200%;" style="text-align:center;">share the tech</p>

</body>
</html>
nano /var/www/html/lab443/index.html
add the following
<!DOCTYPE html>
<html>
<head>
<title>DDRcomputing</title>

</head>
<body>
<body style="background-color:red;">
<h1 style="font-size:500%;" style="text-align:center;">LAB OR DIE</h1>
<p style="font-size:300%;" style="text-align:center;">this web server is running on port 443 encrypted</p>
<p style="font-size:200%;" style="text-align:center;">share the tech</p>

</body>
</html>
sudo service apache2 restart
Comments