Can see my hosted files after upgrading apache

I have lost web browser access to my local PHP files. Fortunately phpmyadmin continues to work nicely.

When I type my server ip in Firefox I get:

Index of /
[ICO] Name Last modified Size Description
Apache/2.4.7 (Ubuntu) Server at localhost Port 80

as if /var/www was empty, which is not the case. I guess that Apache now has some other folder (or none at all) defined as root directory location, but I do not know how to fix it.

4 Answers

Your html or php files have to be moved to the new root:

/var/www/html/
1

The new Apache default server location is /var/www/html. You can move all your files to the new directory or you can do the following on a terminal (as root):

 # cd /etc/apache2/sites-available # nano site1

Now, on nano paste the following:

<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName site1 DocumentRoot /var/www/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory>
</VirtualHost>

Save the file and run these commands (again as root):

 # a2ensite site # nano /etc/hosts

Now add this on the first line: 127.0.0.1 localhost site1

Save the file and reload Apache with this command (again as root):

 # /etc/init.d/apache2 reload

You should get a message telling you site1 is enabled. Now you can safely remove /var/www/html so you don't have an empty directory on your server:

 # rm /var/www/html/

Hope it helps, greetings.

1

If you have virtual hosts defined in sites-available, probably hosted in distinct directories outside of /var/www/html, then you may have stumbled into the new configuration file naming convention.

Make sure your virtual host configuration files end in .conf.

Full explanation here:

Copy all the html files under /var/www/html. Now open the terminal and change the permission with sudo chmod -R 777 /var/www, now you wont get such errors when you run in firefox.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like