LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Apache Virtual Hosts (https://www.linuxquestions.org/questions/linux-general-1/apache-virtual-hosts-77023/)

quozt 07-29-2003 02:37 PM

Apache Virtual Hosts
 
hi me again, right i want to set up a couple of websites on my server (using redhat 9 with all the apache stuff added) i have a thing called Apache Virtual Hosts installed and wondered how it worked at the moment my main host goes to localhost.. but i want to run several more websites (and muds) in different folders to be sent to different domains (eventually) is there an auto generation of those folders with the CGI-BIN and other items installed :) thanks for reading...

Dom

Mathieu 07-29-2003 03:13 PM

No, you will have to setup the directory structure yourself.
If you want a GUI tool for Apache, you can try Webmin.

This thread has information on how to setup Virtual Hosts in Apache.
http://www.linuxquestions.org/questi...threadid=74985

For your domains, you will need to configure a local DNS
or add the entries to /etc/hosts

jpbarto 07-29-2003 03:15 PM

a virtual host allows apache to run multiple websites w/ one server.

lets say your main webserver is:
my.server.com (with ip 192.168.0.5)

and you want to have two more servers:
her.server.com and
store.server.com (both with the same ip (on the same box))

by creating a virtual host you tell apache that when it sees a url of my.server.com to provide content from a specific directory ... say /opt/my_server_com/http

now when someone types in an address of store.server.com even though dns resolves to the same IP as my.server.com apache will see the request as being for store.server.com and serve content from the configured directory of say /opt/store_server_com

hope that helps,
jpbarto

P.S. /opt/store_server_com isn't a required dir name... content could be anywhere... /home/billy or /etc/website-2 ... it really doesn't matter. Also config directives in the virtual host can completely change the behavior of one website compared to another even though they are running on the same server.

elhombre 10-15-2003 09:51 AM

i have site1 on my RH8 system at this time and it works fine. i am trying to setup a virtual host for site2 but the problem is that when i (or anyone) goes to www.site2.com, it will bring up www.site1.com rather than going to the site2 folder where site2's index.html page is. what am i doing wrong?

this is the syntax i have in httpd.conf:

# Virtual host site1
<VirtualHost *>
DocumentRoot /var/www/html/site1
# ServerAdmin
ServerName www.site1.com
# ServerSignature email
DirectoryIndex index.php site1 index.html index.htm index.shtml
# ServerSignature email
# LogLevel debug
# HostNameLookups off
</VirtualHost>

# Virtual host site2
<VirtualHost *>
DocumentRoot /var/www/html/site2
# ServerAdmin
ServerName www.site2.com
# ServerSignature email
DirectoryIndex index.html site2 index.php index.htm index.shtml
# ServerSignature email
</VirtualHost>

<Directory "/">
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory "/var/www/html">
Options Indexes Includes FollowSymLinks
AllowOverride None
Allow from from all
Order allow,deny
</Directory>

<Directory "/var/www/icons">
Options Indexes MultiViews
AllowOverride None
Allow from from all
Order allow,deny
</Directory>

<Directory "/var/www/cgi-bin">
Options ExecCGI
AllowOverride None
Allow from from all
Order allow,deny
</Directory>


All times are GMT -5. The time now is 05:35 AM.