Getting Started with Your AWS Instance and Installing and Setting Up an Apache Server

Share Tweet

Update and upgrade packages:

sudo apt-get update
sudo apt-get upgrade

Install Apache server:

sudo apt-get install apache2

Set up a root folder in home folder and create an index file for testing:

mkdir ~/www
echo ‘Hello, World!’ > ~/www/index.html

Set up your virtual host:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-www.conf
sudo nano /etc/apache2/sites-available/000-www.conf

Modify DocumentRoot to point your “www” folder in home folder (e.g. /home/ubuntu/www)

And add following lines after DocumentRoot line:

<Directory "/home/ubuntu/www">
    Order allow,deny
    Allow from all
    Require all granted

Enable ”www” site and restart Apache:

sudo a2ensite 000-www
sudo service apache2 restart

Finally, go to your public DNS, something like:

Sources: SO, DO Community

Share Tweet


Please start a discussion down below or send me an email!