Cannot access Apache start page via "localhost" in web browser
I had the LAMP stack installed on my Ubuntu machine. Everything was working fine. I had Apache, mySql, phpmyadmin, etc. I'm learning web development, and a friend suggested I try out Drupal. So, I downloaded the tar package, extracted it, began the setup process via an online tutorial, and I kept getting the error "the Settings file is not writable". I went through everything I could think of to change the permissions to no avail. I also downloaded openssh, but had trouble logging in. That was next on the list to uninstall.
I became frustrated thinking I had done something wrong during installation, so I deleted everything I had installed: Apache, php, mysql, and drupal. I believe I got any leftovers taken care of.
Well, I restarted the process and got Apache downloaded, but when I try my I.P. or "localhost," I get the error "this site can't be reached." HOWEVER, if I navigate to the physical folder /var/www/html/index.html, and double click, the Apache "it works!" page comes up.
I wish I could take the snapshot of my computer two days ago and forget this ever happened because one seemingly simple download has caused me nothing but headache.
Any ideas on where I can start to fix my broken machine?
I've added the url to /etc/hosts
the issue is resolved. such as (wpfa.dev
):
127.0.0.1 localhost
127.0.3.1 wpfa.dev
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
OK, there are ways to do that, the first you have to do is to reload configuration:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/*.conf
After that use next commands:
sudo service apache2 reload
sudo service apache2 restart
Make sure default folder is owned by web server, to change permissions use next commands:
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html
sudo service apache2 restart
Also if you had enabled ufw, that use command next command to allow HTTP(HTTPS):
sudo ufw allow 80
#for HTTPS use 443 instead of 80
But if this don't work, then you must reinstall completely apache2 using command:
sudo apt-get remove --purge apache2
sudo apt-get install apache2