LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-11-2011, 10:56 AM   #1
howtechstuffworks
LQ Newbie
 
Registered: Jan 2011
Posts: 8

Rep: Reputation: 0
Apache server


Hi,
I am trying to host a local website(an wiki application) within a network. Is it necessary that all the files I need to upload should be in the var/www ???
 
Old 01-11-2011, 11:24 AM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Welcome to LQ!

No, you can have the files anywhere you want, you just need to edit the DocumentRoot in httpd.conf to reflect where it is. However, be aware that DocumentRoot in httpd.conf will affect all the sites served by that instances of Apache, so if you're serving multiple sites, you might want to check into using virtual hosts.
 
Old 01-11-2011, 01:01 PM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
There are several conventions; /usr/apache/htdocs, /var/www/htdocs and /srv/httpd/<site>/htdocs are common.
 
Old 01-13-2011, 11:09 AM   #4
howtechstuffworks
LQ Newbie
 
Registered: Jan 2011
Posts: 8

Original Poster
Rep: Reputation: 0
It worked Thanks.....
 
Old 02-08-2011, 05:24 AM   #5
whittycat
Member
 
Registered: Nov 2004
Location: Wellington Somerset UK
Distribution: Debian lenny, also DSL-N
Posts: 32

Rep: Reputation: 15
where is Apache server root?

My question seems to fit in this thread. I have just installed Apache2, from the instructions in the book "PHP and MySQL" by Williams and Lane, and at first I got "htdocs/index.html not found". I have the line DocumentRoot "/usr/local/apache2/htdocs" in httpd.conf but I found that all the files in the root
directory of localhost were in /var/www/htdig and not in htdocs. I can make htdocs a link to /var/www/htdig but is this ok? Why is the direction in httpd.conf ignored?
 
Old 02-08-2011, 07:18 AM   #6
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
Originally Posted by whittycat
I have the line DocumentRoot "/usr/local/apache2/htdocs" in httpd.conf but I found that all the files in the root
directory of localhost were in /var/www/htdig and not in htdocs.
Where the files live is pretty irrelevant, so if the root of your web files is /var/www/htdig, then set DocumentRoot to that and restart Apache. That should have Apache looking in the right spot. Of course if you want your files to be someplace else, that is fine as well as long as DocumentRoot points there.


Quote:
Originally Posted by whittycat
I can make htdocs a link to /var/www/htdig but is this ok?
Yeah, it is OK. I personally don't like to do it because it makes it more difficult for someone else to understand what Apache is doing, but there is no reason why you can't. Personally, I prefer to have DocumentRoot point to the right place.

Quote:
Originally Posted by whittycat
Why is the direction in httpd.conf ignored?
I'm not real sure what the question here is, but I'll give it a go anyways. I don't think DocumentRoot is being ignored. In your case it is pointing to /usr/local/apache2/htdocs, and since there are (potentially) no files there, you're getting the "not found" error.
 
Old 02-08-2011, 09:04 AM   #7
whittycat
Member
 
Registered: Nov 2004
Location: Wellington Somerset UK
Distribution: Debian lenny, also DSL-N
Posts: 32

Rep: Reputation: 15
where is apache root?

Thanks, that's helpful. So I can put files in /var/wwww/htdig and apache will find them. I'd still ike to understand though. The book says put index.html in htdocs and it is not found while if I copy it to
htdig it is found. So the 'Document root' line in the httpd conf file apparently has no effect. I can't see where the name htdig comes from. But not to worry I am happy to go forward with what I've got.
 
Old 02-08-2011, 09:29 AM   #8
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
Originally Posted by whittycat
I'd still ike to understand though. The book says put index.html in htdocs and it is not found while if I copy it to
Just remember, the book is probably using "standard" conventions, and your Apache install may differ from what is considered standard. For exmaple, the use of the htdocs directory is just a convention (although one that is probably good to follow), and the htdocs directory can exist wherever you want. For example, a stock Slackware install has DocumentRoot pointing towards /var/www/htdocs, however I prefer to use /home/www/htdocs. It doesn't matter to Apache which one I use, or if I call it htdocs or webfiles, or anything else I want. The only thing Apache pays attention to is what is set in DocumentRoot. And just to give you a bit of extra homework, the DocumentRoot in httpd.conf can be overridden by individual VirtualHosts declarations with their own DocumentRoot. So you really can spread your web files all over the place and Apache should be able to find them.

Quote:
Originally Posted by whittycat
So the 'Document root' line in the httpd conf file apparently has no effect.
If that is true, something is very wrong. Just so we're clear, if you put index.html in /var/www/htdig and set DocumentRoot to /var/www/htdig, Apache should be able to see it and use it. One thing to remember is that after you change httpd.conf, you must restart Apache for the changes to take effect. If this isn't happening, be sure to check your Apache logs (often in /var/log) and see if Apache is complaining about anything.
 
Old 02-08-2011, 09:59 AM   #9
whittycat
Member
 
Registered: Nov 2004
Location: Wellington Somerset UK
Distribution: Debian lenny, also DSL-N
Posts: 32

Rep: Reputation: 15
Apache server root

Thanks for all your help. I'll study the logs. May take me a while but it could be rewarding.
 
  


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
apache server redirecting to apache.org? exley Linux - Software 1 03-13-2006 01:02 AM
problems setting up apache and vsftp server behind a router that serves as a server xone Linux - Security 1 04-08-2004 10:46 AM
Setup linux-apache server to access documents on NT server josephswagner Linux - Software 11 04-11-2003 08:35 AM
Apache Server Config, Mail Server, & Uploading johan the olive Linux - Networking 5 03-14-2003 11:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:11 AM.

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