Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I have setup a server and want to host two websites on it. I have bought two domain names but dont know how i point them to my server ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2006
    Posts
    1

    name based virtual host


    Hi,

    I have setup a server and want to host two websites on it. I have bought two domain names but dont know how i point them to my server and what settings needs to be changed on server to accept the request.
    I have browsed different forums and read about name-based virtual host but problem is that before i get to the point where i change httpd.conf file, what i have to do to point my domain names to my server.

    Any help will be much appreciated.

    thanks

  2. #2
    Just Joined!
    Join Date
    May 2005
    Location
    South Australia
    Posts
    2
    hi
    what OS are you using
    its just coz there is a Vhost maker script out there that will help with making Vhost sites in seconds
    @ http://wiki.craz1.homelinux.com/index.php/MkVhost ( master site ) or a mirror site http://zcau.blogspot.com/2006/10/mkvhost.html



    besites that
    you add to the httpd.conf file

    is at /etc/httpd/ folder
    use your fave text editor or
    vi /etc/httpd/httpd.conf
    you gotta be root user to do this

    like
    Code:
    NameVirtualHost *:80
    Include /etc/httpd/vhost.d/*.conf
    in the include part " the /etc/httpd/vhost.d/
    is where you will put the <sitename>.conf file to


    than for the <sitename>.conf file
    put in there
    Code:
    <VirtualHost *:80>
    	ServerName test.zc22
    	ServerAlias www.test.zc22
    	ServerAdmin user@host.com
    	DocumentRoot /var/www/vhosts/test.zc22/htdocs
    	
    	RewriteEngine on
    	RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
    	RewriteRule .* - [F]
    	
    	CustomLog /var/www/vhosts/test.zc22/logs/access_log combined
    	ErrorLog /var/www/vhosts/test.zc22/logs/error_log
    	
    	php_admin_value open_basedir "/var/www/vhosts/test.zc22/htdocs:/var/www/vhosts/test.zc22/tmp"
    	php_admin_value upload_tmp_dir "/var/www/vhosts/test.zc22/tmp"
    	
    	## make sure register_globals is off
    	php_flag register_globals "Off"
    		
    	## No .htaccess reading
    	<Files ~ "^\.ht">
    	  Order allow,deny
    	  Deny from all
    	  Satisfy All
    	</Files>
    	
    	<Directory "/var/www/vhosts/test.zc22/htdocs">
    	  Options -Indexes
    	  
    	  # AllowOverride controls what directives may be placed in .htaccess files.
    	  # It can be "All", "None", or any combination of the keywords:
    	  #   Options FileInfo AuthConfig Limit
    	  #
    	  # leave as None to keep apache running faster (unless needed)
    	  AllowOverride None
    	  
    	  Order deny,allow
    	  Allow from all
    	</Directory>
    		
    
            # delete the cgi-bin block if you do not want
    	# this vhost to have it's own cgi-bin/
    	## BEGIN: cgi-bin
            ScriptAlias /cgi-bin/ "/var/www/vhosts/test.zc22/cgi-bin/"
    	<Directory "/var/www/vhosts/test.zc22/cgi-bin">
    	  AllowOverride None
    	  Options None
    	  Order deny,allow
    	  Allow from all
    	</Directory>
    	## END: cgi-bin
    
    
    		  AllowOverride None
    		  Options None
    		</Directory>
    	</IfModule>
    
    </VirtualHost>
    *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    repleace the test.zc22 with your site name
    and the user@host.com with the admin email address you want there
    *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

    than you just make folders
    mkdir /var/www/vhosts
    mkdir /var/www/vhosts/<sitename>
    mkdir /var/www/vhosts/<sitename>/logs
    mkdir /var/www/vhosts/<sitename>/htdocs
    mkdir /var/www/vhosts/<sitename>/cgi-bin
    mkdir /var/www/vhosts/<sitename>/tmp


    than if your redhat / FC
    than services httpd restart

    and it should be working
    but you going to see its easyerto use the script

    than to see them without a problem
    just edit the /etc/hosts file
    and add
    like
    192.168.0.250 <tab key> www.lan
    192.168.0.250 <tab key> vdb.lan

    save it
    and than you should be able to on that box be able to view the vhost sites
    if you on a network with windows pcs as well
    add the IP <Tab key> vhost address (www.lan)
    to the c:\WINDOWS\system32\drivers\etc\hosts file
    save it
    and than if you got open any web browsers close them
    than you should be able to access the vhost address

    hope this helps you in a way
    sorry if u got a tab lost there
    it took me a while to learn it myself how to do this


    *** updated ****

Posting Permissions

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