LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-16-2004, 03:00 AM   #1
darb
LQ Newbie
 
Registered: Mar 2004
Location: Vancouver, B.C.
Distribution: IPcop1.4 & Deb3.1
Posts: 13

Rep: Reputation: 0
Apache 2 install config


I just installed apache 2, it is up and running fine, but I can't figure out how to change the root WWW dir from the /apache2 install.

I have found the docs:

Code:
Description:     Directory that forms the main document tree visible from the web
Syntax:	        DocumentRoot directory-path
Default:	DocumentRoot /usr/local/apache/htdocs
Context:	server config, virtual host
Status:	Core
Module:	core

This directive sets the directory from which httpd will serve files.
Unless matched by a directive like Alias, the server appends the path from the 
requested URL to the document root to make the path to the document. 
Example:

DocumentRoot /usr/web

then an access to http://www.my.host.com/index.html refers to /usr/web/index.html.

The DocumentRoot should be specified without a trailing slash.
But, I have no idea what file to edit. I can't find it in apache2.conf

Also I wan't to run a couple of websites on my dynamic ip using no-ip. Will this work:

Code:
 <VirtualHost *:8088>
DocumentRoot /www/example1
ServerName www.example1.no-ip.com

# Other directives here

</VirtualHost>

<VirtualHost *:8088>
DocumentRoot /www/example2
ServerName www.example1.example2.org
 # Other directives here

</VirtualHost>
 
Old 10-16-2004, 04:22 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
it will be in that config file somewhere, or if your version uses multiple config files for ease of management, you might have a commonapache2.conf too..? I don't see what you mean by not being able to find it though... you've found it in your second code block there... those virtual hosts look ok to me.
 
Old 10-16-2004, 11:32 PM   #3
darb
LQ Newbie
 
Registered: Mar 2004
Location: Vancouver, B.C.
Distribution: IPcop1.4 & Deb3.1
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks for the reply acid. Both code blocks are from the apache docs, easy to find but NOT easy to understand.

WHY doesn't the software industry adhere to the KISS rule?

I did a deb install and from what I can tell have the following config files to choose from:

htppd.conf - appears to be just a legacy file.

apache2.conf - 1.) I can't find any reference to DocumentRoot. 2.) The only reference to VirtualHost is at the very end of the file which refers to: Include /etc/apache2/sites-enabled/[^.#]*

/etc/apache2/sites-enabled/ containes one file: 000-default

This file is obviously a virtual host configuration file, but apart from configure the file W.T.H. do I do with it?

Do I rename it to match the Vhost name?

Do I create one file for each Vhost?

This file still doesn't match the example that I found in the docs(the second code block). There is more config choices than I need or want, you should be able to just set the DocumentRoot and ServerName and leave all of the other configurations global, correct?
 
Old 10-17-2004, 12:02 AM   #4
rajbaxi
Member
 
Registered: Jul 2003
Location: MI
Distribution: redhat,mandrake,debian
Posts: 68

Rep: Reputation: 15
what editor are you using? try using something like pico or nano. You can search for the pattern DocumentRoot. It's there somewhere.
 
Old 10-17-2004, 05:06 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
[[KISS]] only really goes so far. At this level, KISS just leaves you with a simple and stupid application. That's not exactly what is required from a web server now is it?

ok so this is on debian, which i've never used... so the virtual hosts are in that sites-enabled directory... so you'd presumably wnat to create another file in there for your domain, and inside that, you'll be free to change the DocumentRoot anyway. You should be able to chaneg it globally in the main apache2.conf, but it'll be outwardly identical whichever way you did it.
 
Old 10-17-2004, 02:00 PM   #6
darb
LQ Newbie
 
Registered: Mar 2004
Location: Vancouver, B.C.
Distribution: IPcop1.4 & Deb3.1
Posts: 13

Original Poster
Rep: Reputation: 0
I meant KISS in respect to the documentation for apache, or any other software(linux) for that matter.

The docs for apache are not anywhere near approaching KISS. Actually it isn't even accurate, or at lease it is contradictory. For example, the docs state that The main configuration file is usually called httpd.conf, yet the file states: This is here for backwards compatibility reasons and to support installing 3rd party modules directly via apxs2, rather than through the /etc/apache2/mods-{available,enabled} mechanism. Helpful, NO in both cases.
Quote:
You should be able to change it globally in the main apache2.conf, but it'll be outwardly identical whichever way you did it.
Yes, that is exactly what I want to do, but don't know how. The ONLY reference to virtual host in my apache2.conf file is:
Code:
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/[^.#]*
/etc/apache2/sites-enabled/ contains one file, 000-default.

The 000-default file is a virtual host configuration file with an extensive amount of configuration options.

Do I config a copy of this file for each virtual host that I want to set up?
What do I name it, 001--vhostnameA & 002--vhostnameB ?

What about the example from the docs:
Code:
 <VirtualHost *:8088>
DocumentRoot /www/example1
ServerName www.example1.no-ip.com

# Other directives here

</VirtualHost>

<VirtualHost *:8088>
DocumentRoot /www/example2
ServerName www.example1.example2.org
 # Other directives here

</VirtualHost>
That is all the configuration that I want or need (KISS) where could I use it instead?

There is also a second directory called /etc/apache2/sites-available/ that contains a file: "default" which appears to be identical to /etc/apache2/sites-enabled/000-default. What is this for?

Thanks, Brad
 
Old 10-17-2004, 02:16 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
well this is just a difference in scope for apache / distros. you're presumably reading official apache documentation, which is wholly accurate when related to the official apache source, however is a distro takes it upon themselves to try tosplit up the configuration for reasons they feel they can justify, that's not apaches fault.

But anyway. For your virtual host, a file containing nothing but one of the examples above, e.g:
Code:
<VirtualHost *>
DocumentRoot /www/example2
ServerName www.example1.example2.org
</VirtualHost>
will probably work fine, with the file named accordingly. I have to admit i've not seen a config layout as cut up as that though.
 
Old 10-17-2004, 02:16 PM   #8
rajbaxi
Member
 
Registered: Jul 2003
Location: MI
Distribution: redhat,mandrake,debian
Posts: 68

Rep: Reputation: 15
why don't you just create your own apache2.conf or httpd.conf and put what you want? Just make sure your script points to the right conf file on startup.
 
Old 10-17-2004, 02:19 PM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
well i wouldn't recommend starting from scratch... but in a similar vein you could actually just tag anything at all that you want onto the end of apache2.conf anyway, the individual files are not needed as such.
 
Old 10-17-2004, 02:39 PM   #10
darb
LQ Newbie
 
Registered: Mar 2004
Location: Vancouver, B.C.
Distribution: IPcop1.4 & Deb3.1
Posts: 13

Original Poster
Rep: Reputation: 0
so I could just replace:

Include /etc/apache2/sites-enabled/[^.#]*

in apache2.conf

with:

<VirtualHost *:8088>
DocumentRoot /www/example1
ServerName www.example1.no-ip.com

</VirtualHost>

<VirtualHost *:8088>
DocumentRoot /www/example2
ServerName www.example2.no-ip.com
# Other directives here

</VirtualHost>

As I haven't mentioned, but should be obvious I am a newbie.
 
Old 10-17-2004, 03:20 PM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
yes, but remember that that does go against the design methods being used within the distro. also you preumably wouldn't want to be using port 8088 etc.....
 
Old 10-18-2004, 02:18 PM   #12
cavingreer
LQ Newbie
 
Registered: Oct 2004
Posts: 6

Rep: Reputation: 0
Just above the virtual hosts section is a line that says
#NameVirtualHost *:80

If you uncomment it you can use the name based virtual hosts and below that you
can just start adding virtualhost sections for each domain you want to host.
 
Old 10-18-2004, 08:10 PM   #13
darb
LQ Newbie
 
Registered: Mar 2004
Location: Vancouver, B.C.
Distribution: IPcop1.4 & Deb3.1
Posts: 13

Original Poster
Rep: Reputation: 0
Actually mine comes already uncommented and there is also no servername variable in the file like in the docs.
Code:
NameVirtualHost *
<VirtualHost *>
	ServerAdmin webmaster@localhost
	
	DocumentRoot /var/www/
	<Directory />
and I have a seperate ports.conf file to specify the IP/port(s) to listen on.

I am having problems getting the virtual sites up and responding and was wondering about that and assumed that the ports.conf file maintain the setting for the server?

I did want port 8088 because I am running this at home and port 80 is blocked, plus no ...
 
Old 10-18-2004, 08:47 PM   #14
darb
LQ Newbie
 
Registered: Mar 2004
Location: Vancouver, B.C.
Distribution: IPcop1.4 & Deb3.1
Posts: 13

Original Poster
Rep: Reputation: 0
The files are here , to give you a better idea.

Also, how can I execute a local request for a local virtual site? Doesn't the request have to include the site name, otherwise it will go to the default site?
 
Old 10-19-2004, 06:35 PM   #15
darb
LQ Newbie
 
Registered: Mar 2004
Location: Vancouver, B.C.
Distribution: IPcop1.4 & Deb3.1
Posts: 13

Original Poster
Rep: Reputation: 0
Also could I simply strip out my current files (config) and replace them with the "OEM" ones?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 config doralsoral Linux - Software 1 11-04-2005 09:01 PM
apache config xpace Linux - Networking 22 08-26-2005 03:36 AM
Apache Config riluve Linux - Software 1 02-14-2005 02:42 PM
Apache config silmaril8n Linux - Newbie 8 11-11-2004 04:02 PM
apache config. drkfir5 Linux - Software 9 10-25-2004 02:05 AM


All times are GMT -5. The time now is 07:02 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration