LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-30-2010, 07:42 PM   #1
rtoney5
Member
 
Registered: Oct 2007
Location: FL, US
Distribution: Ubuntu MintLinux, ChromeOS, Parted Magic, PCOS OpenWorkstation, OpenSuse-11
Posts: 139

Rep: Reputation: 24
Apache2 root server showing directory contents of a symbolic link in the /var/www dir


Hello: I'm running Ubuntu 9.04 and for some reason when I copied a different index.html file into my /var/www directory, when I pull up my servername in the web browser http://SomeServer.com it displays the directory contents of a subdirectory lets call bigtimer. Even when I type in http://Someserver.com/index.html it displays an error message url /index.com can't be found. When I check my error.log in /var/log/apache2 directory the messages say File Does Not Exist: /var/www/bigtimer.index.html.
I realize now I forgot to stop the apache2 server before I blazingly went in there and updated index.html to a newer version.
I even tried reinstalling apache2 components, and no joy.
I can pull up http://localhost/bigtimer and it servers pages properly and any other site I have. But when it comes to the root server i'm getting a directory. I even added DirectoryIndex index.html to my /etc/apache2/sites-available/default file. Still it's giving me a listed directory.
Scratching my head on this one cause i'm stumped. Any help would be appreciated.
Thanks,
 
Old 08-30-2010, 08:34 PM   #2
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 101Reputation: 101
Post your Apache configuration file please?
 
Old 08-31-2010, 06:10 PM   #3
rtoney5
Member
 
Registered: Oct 2007
Location: FL, US
Distribution: Ubuntu MintLinux, ChromeOS, Parted Magic, PCOS OpenWorkstation, OpenSuse-11
Posts: 139

Original Poster
Rep: Reputation: 24
Thanks, but I'd rather not post online my apache configuration file. No changes were made to the file. This started occurring when I copied a newer version of index.html into my root directory. Any help on refreshing symbolic links or directory/file indexes would be good.
Thanks,
 
Old 09-01-2010, 11:10 AM   #4
tracertong
Member
 
Registered: Jun 2010
Posts: 34

Rep: Reputation: 16
Quote:
Originally Posted by rtoney5 View Post
Thanks, but I'd rather not post online my apache configuration file. No changes were made to the file. This started occurring when I copied a newer version of index.html into my root directory. Any help on refreshing symbolic links or directory/file indexes would be good.
Thanks,
Possibly not, but we'd need to see what you were starting from, in order to guess a cause.

I mean, you state the browser reports it can't find index.com - is this a typo? It shouldn't be looking for index.com, surely, it should be seeking index.html. Furthermore, you state the logs say "/var/www/bigtimer.index.html" is missing, but of course it is: bigtimer.index.html isn't a file (bigtimer/index.html might be).

More information needed.
 
Old 09-02-2010, 12:41 PM   #5
rtoney5
Member
 
Registered: Oct 2007
Location: FL, US
Distribution: Ubuntu MintLinux, ChromeOS, Parted Magic, PCOS OpenWorkstation, OpenSuse-11
Posts: 139

Original Poster
Rep: Reputation: 24
Yes type on index.com should be index.html. Also typo on the /var/www/bigtimer.index.html, should be /var/www/bigtimer/index.html. As you can see on the keyboard, easy to make that typo as those keys are right next to each other.
But again, nothing changed on the configuration files, just that I copied index.html into the /var/www directory and replaced the older file.
Are you aware of past issues with apache where it can't find the index.html or serves up a linked directory instead of the /var/www directory?
Thanks,
 
Old 09-03-2010, 03:26 AM   #6
tracertong
Member
 
Registered: Jun 2010
Posts: 34

Rep: Reputation: 16
No, there are no such issues with Apache. In this case (as in all cases) Apache is doing exactly what it is being told to do, and until we see what it is being told to do, we cannot do anything more than guess what is going on. Which is why the config file would be useful.

(This is the great thing about computers they are not fickle: they do exactly what you tell them to do. So, if they are not doing what you expect them to do, all you have to do is work out what you are telling them to do, and there's your answer.)

Here's my guess, however: the Index file, specified in that Apache config file, is something like 'index.html' - with a few alternatives, such as 'index.php', or 'default.html' listed as alternatives. Where it cannot find such a file it's fall-back behaviour is to give the DirectoryIndex, instead (this is a bad feature, and should be disabled in your Apache config file, by the way).

You may have deleted a valid 'index.html' file and copied in an 'index.htm' or an 'Index.html' file, in it's place. Apache is both case-sensitive, and incapable of making guesses, so in the absence of an file of exactly the specified type, it is reverting to its fall-through behaviour, of listing the DirectoryIndex, instead.

As I say, the answer lies in the Apache config.
 
Old 09-03-2010, 03:52 AM   #7
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Rep: Reputation: 62
Remove Follow Symlinks from your conf file?
 
Old 09-03-2010, 07:50 PM   #8
rtoney5
Member
 
Registered: Oct 2007
Location: FL, US
Distribution: Ubuntu MintLinux, ChromeOS, Parted Magic, PCOS OpenWorkstation, OpenSuse-11
Posts: 139

Original Poster
Rep: Reputation: 24
SOLUTION to Apache2 root server showing invalid symbolic link

Well my friends, the solution for me was to backup my entire /etc/apache2 directory ***AND*** my entire /var/www DIRECTORY, then completely remove the 3 Apache2 packages ( and synaptic removes the other packages). After synaptic removes the apache2 packages, it seems to leave /var/www and other directories such as /etc/apache2 intact because they still had my config files in them. So leave the config files as they are and just delete everything in /var/www, then cd .. to the /var directory and do a rm -r ./www to remove the www directory.

Don't worry, when you reinstall the apache2 and the other 2 packages, it will create the /var/www directory again. So here are the general steps.

***OF COURSE PLEASE MAKE BACKUPS FIRST!!!! DON'T BE AN EGGHEAD LIKE ME AND FORGET, THEN YOUR ...***

Ok so General Steps...:
**note yourDIR is your user directory, mine for example is /home/egghead

cd /etc
sudo tar czf /home/yourDIR/apache2-BACKUP-curdate.tbz ./apache2
cd /home/yourDIR
mkdir ./APACHE2-ROOT-DIR-BACKUPfolder
cd /var/www/
sudo cp -r ./* ./APACHE2-ROOT-DIR-BACKUPfolder

***nOW That backups are done, remove apache2***
Open synaptic package manager and remove apache2 and the other bin and common packages apache2 uses.
***WARNING RED ALERT PAY ATTENTION****
I did a completly remove 3 packages and synaptic warns you about it removing other packages, pay attention to what is being removed. If you're concerned with packages being removed like wordpress, phpmyadmin or others, make a backup of those configuration files just in case.***

once it's removed do the following...:
cd /var/www
sudo rm -r ./*
cd /var
sudo rm -r ./www
Now the www folder went bye bye.

***now install apache2 again. I suggest using the command line like...:
sudo apt-get update
(trust me, just do this so you're up to date with your packages)
then...:
sudo apt-get install apache2
just say Y to the prompt as it will ad the other 2 packages you need automatically.

You may have to reinstall phpmyadmin if you were using it.
or wordpress and other as previous mentioned above.

***One side note, if you were using mod_jk, reinstall it because it was probably removed. Right after you reinistall it goto
cd /etc/apache2/mods-enabled and relink the jk.load file like so...

cd /etc/apache2/mods-enabled
sudo ln -s /etc/apache2/mods-available/jk.load jk.load

If you don't do this, and you try to start up apache server, you'll keep getting the error message about JkWorkerFile not valid or similar message.

If you don't have mod_jk, then don't worry about the above.

So at this point just startup apache again...:
sudo /etc/init.d/apache2 start

You should get a big fat [OK] after it starts.
Pull up your server like so and you should be in business...:
Open Web Browser...:
http://localhost or http://localhost/index.html or http://localhost/bigtime

***Now I know all of this probably overdoing it, but I wanted to completely remove apache2 (minus the config files cause nothing was wrong with them) and reinstall it. I did it this way to be use I started over. i could have simply made a backup of the /var/www directory structure, and just remove /var/www contents then remove the www directory, then create www directory agaiin and copy the backup of var/www back in again, but again I wanted to be sure.
***And to those of you who are curious, yes it did work, WITHOUT removing or altering any CONFIGURATION files.***
***LESSON LEARNED, whenever you want to copy files into the root directory of Apache's /var/www directory stop the server first. Otherwise you'll be reading this post :-/
Thanks,
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Who should own /var/www and it's contents? morrolan Linux - Server 4 04-03-2007 02:55 PM
Symbolic Link For FTP Access To /var/www/html ERRRRRRRRRRRR! JustinK101 Linux - Software 3 01-31-2007 11:32 AM
apache server setup and how to place files in the var/www/html directory dramous Linux - Software 3 09-25-2004 02:38 AM
apache server setup and how to place files in the var/www/html directory dramous Linux - General 2 09-25-2004 01:29 AM
mysterious symbolic link in root dir dubman Linux - Security 1 04-12-2004 07:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration