SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help me with Virtual Servers in Apache 2.2.X Web server

    Hello Everyone,
    I have six web applications (developed in PHP) on one Apache web server. Each application is in a folder.
    Now I want each application to be resolving to its own url. e.g when someone type http://hostname/folder1 it resolves to
    a folder one, then when http://hostname/folder2 is typed in the broswer it resolves to folder2.

    I am using virtual server in apache as shown below, but it is not working where I am going wrong???

    How can I achieve it???


    # Ensure that Apache listens on port 80
    Listen 80

    # Listen for virtual host requests on all IP addresses
    NameVirtualHost *:80

    <VirtualHost *:80>
    DocumentRoot /www/folder1
    ServerName http://hostname/folder1

    # Other directives here

    </VirtualHost>

    <VirtualHost *:80>
    DocumentRoot /www/folder1
    ServerName http://hostname/folder2

    # Other directives here

    </VirtualHost>

  2. #2
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey ZZ,

    I have done the same thing on my dev server. Following is what you need to do:

    Locate the "bin\apache\apache2.2.6\conf\extra\httpd-vhosts.conf" file and add this:

    Code:
    <VirtualHost *:80>
    	ServerName www.lavilladelossuenos.com
    	ServerAlias work.lavilladelossuenos.com lavilla
    	DocumentRoot C:/wamp/www/tylerweb/public_html/lavilladelossuenos.com
    	ErrorLog C:/wamp/www/tylerweb/public_html/lavilladelossuenos.com/logs/error.log
    	CustomLog C:/wamp/www/tylerweb/public_html/lavilladelossuenos.com/logs/access.log common
    </VirtualHost> 
    
    <VirtualHost *:80>
    	ServerName www.txrangeriders.org
    	ServerAlias work.txrangeriders.org rangeriders
    	DocumentRoot C:/wamp/www/tylerweb/public_html/txrangeriders.org
    	ErrorLog C:/wamp/www/tylerweb/public_html/txrangeriders.org/logs/error.log
    	CustomLog C:/wamp/www/tylerweb/public_html/txrangeriders.org/logs/access.log common
    </VirtualHost>
    
    <VirtualHost *:80>
    	ServerName www.hel.org
    	ServerAlias work.hel.org hel
    	DocumentRoot C:/wamp/www/tylerweb/public_html/hel.org
    	ErrorLog C:/wamp/www/tylerweb/public_html/hel.org/logs/error.log
    	CustomLog C:/wamp/www/tylerweb/public_html/hel.org/logs/access.log common
    </VirtualHost>
    Add a VirtualHosts for each domain you want set up.
    You can add 1 or multiples to the ServerAlias.
    Be sure to create a "logs" folder and add the path to the Error Log and the CustomLog. You do not need to create the files, just the folders.

    Then go to your host file "C:\WINDOWS\system32\drivers\etc\hosts" and add one line for each site:

    127.0.0.1 hel
    127.0.0.1 rangeriders
    127.0.0.1 cole
    127.0.0.1 jeffey

    Restart the server and it should work!

    Jeff


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •