Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Name based virtual servers with different users 2

Status
Not open for further replies.

spazboy

Technical User
Jun 28, 2003
1
US
I have one IP on my server. I am trying to have three virtual servers on it. I have set it up like this:

Code:
NameVirtualHost *

#Main Server
<VirtualHost *>
  ServerName milas.dnsalias.com
  DocumentRoot /var/[URL unfurl="true"]www/html[/URL]
</VirtualHost>

#Virtual Host 1
<VirtualHost *>
  ServerName boballen.dyndns.org
  DocumentRoot /var/[URL unfurl="true"]www/virtual/bob_allen[/URL]
</VirtualHost>

#Virtual Host 2
<VirtualHost *>
  ServerName milas.gotdns.com
  DocumentRoot /var/[URL unfurl="true"]www/virtual/milas[/URL]
</VirtualHost>

I am running Mandrake 9.1 with Apache 2.0.45. The problem with this setup is that, while they direct fine, I have annoying errors with permissions since Apache is running as a different user than the users log into FTP as. I see you can set the user/group Apache runs as in an IP-based virtual host, but I can't figure out how to do something like this for a named virtual host.

Is this possible? And if so, how?

I read some of the Apache documentation, and it showed that you could use hostnames for an IP-based virtual server (while they don't reccomend it because of DNS problems), so would this work using a hostname or not since they are all on the same IP? I only have one (external) IP and it is dynamic.

Anyone have any suggestions? Is there any reference on how to do something like this or does anyone know of an alternative?

Thanks in advance for any help.
 
Apache and your ftp server know nothing about each other so we should leave it that way. :) The problem you are haveing with permissions is that none are set in your vhost containers. Even though you have the permissions set at the system level using chmod, you still need to set them within apache. Lat's say you have a DocumentRoot /var/ you need to tell apache who can do what in that directory. You would do it by creating a directory container for it. Here's an example:

<Directory &quot;/var/
Options Indexes FollowSymLinks
AllowOverride none
Order allow, deny
Allow from all

</Directory>

Notice that I have html inside of milas. I think this makes it easier to set permissions both in httpd.conf and with chmod. Inside of /var/ you would see three directories. html, cgi-bin and logs. I like to put logs within the user's webspace so they have direct access to them. When you have the cgi-bin outside the html directory, you will need to use the ScriptAlias directive. You should have an example of how to use it and create a directory container in httpd.conf main section. Just copy and paste the directory containers into each vhost makes life easier than typing if you're a two fingered typed like me. :) When you define a directory container. All directives within it apply to all it's sub-directories uless you create another directory container. In most cases, you don't need to redefine directives not inside of containers in the main because they are said to be globally defined and apply to your vhosts unless you change them by redefining a directive inside a vhost container.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top