Creating Virtual Hosts in Ubuntu 13.10 Desktop Edition

Discussion in 'Server Operation' started by N3RVE, Jan 26, 2014.

  1. N3RVE

    N3RVE New Member

    Hello There,

    I'm new to server management in Ubuntu. I have a VPS at Linode powered by Ubuntu 13.10 Server edition. I run Ubuntu 13.10 Desktop edition on my laptop and I have a LAMP stack setup with a web directory that works out of an assigned folder in my home folder.

    I'm trying to achieve this setup:

    A new Virtual host setup with an IP address different from the localhost or, I tried using So under /etc/apache2/sites-available, I created and this is the content of the file:

    <VirtualHost *:80>
    	# The ServerName directive sets the request scheme, hostname and port that
    	# the server uses to identify itself. This is used when creating
    	# redirection URLs. In the context of virtual hosts, the ServerName
    	# specifies what hostname must appear in the request's Host: header to
    	# match this virtual host. For the default virtual host (this file) this
    	# value is not decisive as it is used as a last resort host regardless.
    	# However, you must set it for any further virtual host explicitly.
    	ServerAdmin [email protected]
    	DocumentRoot /home/n3rve/www2
    	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    	# error, crit, alert, emerg.
    	# It is also possible to configure the loglevel for particular
    	# modules, e.g.
    	#LogLevel info ssl:warn
    	ErrorLog ${APACHE_LOG_DIR}/error.log
    	CustomLog ${APACHE_LOG_DIR}/access.log combined
    	# For most configuration files from conf-available/, which are
    	# enabled or disabled at a global level, it is possible to
    	# include a line for only one particular virtual host. For example the
    	# following line enables the CGI configuration for this host only
    	# after it has been globally disabled with "a2disconf".
    	#Include conf-available/serve-cgi-bin.conf
    <Directory "/home/n3rve/www2">
       Order allow,deny
       Allow from all
       AllowOverride FileInfo
       # New directive needed in Apache 2.4.3: 
       Require all granted
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    I edited the /etc/hosts file as follows:

    Code:	localhost	B-613	localhost	B-613
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    Then in a terminal window, I ran a2ensite and it asked me to run service apache2 reload which I did. Now when I try to run a2ensite, it says Site already enabled.

    When I try to visit, it doesn't work. Looking at the above setup, what have I or haven't I done, and how can I get it working?
    I appreciate any help.

Share This Page