Getting Started with Your AWS Instance and Installing and Setting Up an Apache Server
By Güngör Budak
- One minute read - 108 wordsUpdate 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
</Directory>
Enable “www” site and restart Apache:
sudo a2ensite 000-www
sudo service apache2 restart
Finally, go to your public DNS, something like:
http://ec2-XX-XX-XXX-XX.us-west-2.compute.amazonaws.com/
Sources: SO , DO Community