Hosting a Local HTML Website with Apache 2

Need root access

sudo nano /etc/hosts

ADD

0.0.0.0 domain.com
0.0.0.0 http://www.domain.com

SAVE

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/domain.com.conf
sudo nano /etc/apache2/sites-available/humblehackers.com.conf

UNCOMMENT AND COMMEON
ServerName http://www.domain.com
ServerName domain.com

ServerAdmin root@domain.com
DocumentRoot /var/www/humblehackers/public_html

sudo a2ensite domain.com.conf

create .html file in the directory above ^^

sudo service apache2 restart

====THE WEBSITE IS BEING HOSTED LOCALLY====

Push the website on port 80

sudo iptables -vL INPUT -n

(if the firewall on the machine doesn’t allow incoming connecitons to reach port 80/tcp, run)

sudo iptables -I INPUT -p tcp –dport 80 -j ACCEPT