RE: Apache Virtual Host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Craig,

You should be able to add User and Group directives to the httpd.conf file.
Also, if you want to use a separate conf file outside of the httpd.conf file
you can also put an Include directive in the VirtualHost block.  Examples
are below.

I use Plesk Administrator to automatically set these up for me, but I don't
see why you couldn't make a script which does the same.  Each new host you
would just have the script append a new VirtualHost block to the httpd.conf
file.  The way that Plesk does this is that it actually appends to a
separate file called httpd.include which is included at the bottom of the
httpd.conf file.

Once changes are made to either of these files, you need to restart apache
for changes to take effect.

Eg. 

<VirtualHost ip:80>
        ServerName   www.domain.com
        User         domainuser
        Group        domaingroup
        ServerAdmin  "root@xxxxxxxxxx"
        DocumentRoot /home/httpd/domain.com/httpdocs/
        CustomLog  /home/httpd/domain.com/logs/access_log combined
        ErrorLog   /home/httpd/domain.com/logs/error_log
	...
        Include /home/httpd/domain.com/conf/vhost.conf
</VirtualHost>

I hope this helps.

Also, another cool trick that Plesk uses is that it sets up a redirect from
domain.com with every host so it resolves to http://www.domain.com.

<VirtualHost ip:80>
        ServerName   domain.com
        RedirectPermanent / http://www.domain.com/
</VirtualHost>

-Jay Corrales


-----Original Message-----
From: redhat-list-admin@xxxxxxxxxx [mailto:redhat-list-admin@xxxxxxxxxx] On
Behalf Of redhat-list-request@xxxxxxxxxx
Sent: Wednesday, October 29, 2003 9:00 AM
To: redhat-list@xxxxxxxxxx
Subject: redhat-list digest, Vol 1 #8446 - 9 msgs

Message: 1
From: "Joe Polk" <listuser@xxxxxxxxxxxxx>
To: redhat-list@xxxxxxxxxx
Subject: Re: Apache Virtual Host
Date: Wed, 29 Oct 2003 12:34:34 -0400
Reply-To: redhat-list@xxxxxxxxxx

Okay, then I misunderstood. Mine runs as user apache with no problems. I 
think there is a configuration problem somewhere. I'm not running Apache 2 
yet, so I can only tell you from my experience on 1.3x. I do know that you 
have to load your default server as a vhost as well or you won't be able to 
server vhosts. And something tells me I got forbidden errors until I did,
but 
I may be mistaken.

<<JAV>>

---------- Original Message -----------
From: Craig Daters <craig@xxxxxxxxxxxxx>
To: <redhat-list@xxxxxxxxxx>
Sent: Wed, 29 Oct 2003 09:15:23 -0700
Subject: Re: Apache Virtual Host

> No, All I am getting are the 500 Forbidden errors. I understand what 
> is causing them. What I am looking for is how to get the Apache 
> webserver to work with Virtual Hosting.
> 
> Because Apache is running as user-apache and group-apache, it cannot
> therefore access the folder /home/westpress/public_html because the folder
> is owned by user-westpress and group-westpress. Like wise with 
> jsdzyn and teamtrailer.
> 
> I can only get this working if I change user/group from 
> apache/apache to westpress/westpress and then add westpress to group 
> jsdzyn and teamtrailer and change permissions accordingly. But I 
> have a problem running cgi scripts and suexec, where it expects 
> apache to run as the same user who happens to own the scripts.
> 
> This is very difficult in an environment where I have three different
> users/passwords running three different websites using one server.
> 
> I am just wondering how ISP's can provide web hosting services to their
> thousands of users running one apache server. I have seen some 
> configs which use a default type of httpd.conf, with includes for 
> all the virtual containers. When I try something similar, then I get 
> the 500 Forbidden errors. When I look at my own personally hosted 
> website (who runs Psoft's Hsphere solution for webhosting) I see 
> that they only run one instance of Apache with virtual host included 
> containers. All of my directories and files are owned by cdaters and 
> have the appropriate permissions of 644 or 755 respectively. So how 
> can they do it, and I cannot? Maybe I am missing something?
> 
> It is the same with my 'westpress' user on the server here at work 
> that I have setup. 755 and 644 respectively, all owned by the 
> 'westpress' user and group. When apache runs as 'apache' 500 
> Forbidden errors. When I change apache to run as 'westpress' 
> everything runs just groovy! (Excluding jsdzyn and teamtrailer 
> ofcourse)
> 
> On 10/29/03 8:39 AM, "Parker Morse" <morse@xxxxxxxxxxx> spoke thusly:
> 
> > On Wednesday, Oct 29, 2003, at 10:09 US/Eastern, Craig Daters wrote:
> >> Initially on my RHL machine, Apache was configured to run as 'user
> >> apache'
> >> and 'group apache'. I set up virtual host containers for 'westpress',
> >> 'jsdzyn' and 'teamtrailer'. I then restarted apache, and upon pointing
> >> my
> >> browser to www.westpress.com, or www.jsdzyn.com etc...get error
> >> messages.
> >> Now I understand why this is happening--the whole user and group
> >> permissions
> >> thing.
> > 
> > Craig, I may be misunderstanding your message, but I only see you
> > looking for the source of the errors in the Apache configuration. Is
> > the mode of the files in the document trees themselves set correctly
> > (that is, probably at least 644)?
> > 
> > pjm
> > 
> 
> Craig D.
> 
> -- 
> 
> Craig Daters (craig@xxxxxxxxxxxxx)
> Systems Administrator
> West Press Printing & Copying
> 1663 West Grant Road
> Tucson, Arizona 85745-1433
> USA
> 
> Tel: 520-624-4939
> Fax: 520-624-2715
> 
> www.westpress.com
> 
> --
> 
> -- 
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
------- End of Original Message -------


--__--__--

__
redhat-list mailing list
Unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list


End of redhat-list Digest
------- End of Original Message -------


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux