Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 ???
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.
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?
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.