Read more: How to install a LAMP stack on Ubuntu 12.x
Step 1: edit /etc/apache2/ports.conf file
# If you just change the port or add more ports here, you will likely also # have to change the VirtualHost statement in # /etc/apache2/sites-enabled/000-default # This is also true if you have upgraded from before 2.2.9-3 (i.e. from # Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and # README.Debian.gz #NameVirtualHost *:80 #Listen 80 NameVirtualHost 176.31.75.56:80 Listen 176.31.75.56:80 NameVirtualHost [2001:41d0:a:3171:0:1041:2729:a652]:80 Listen [2001:41d0:a:3171:0:1041:2729:a652]:80 <IfModule mod_ssl.c> # If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sites-available/default-ssl # to <VirtualHost *:443> # Server Name Indication for SSL named virtual hosts is currently not # supported by MSIE on Windows XP. Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule>
Step 2: edit/add file yourdomain in folder /etc/apache2/sites-enabled/
Ex: file tutorialspots.com
<VirtualHost 176.31.75.56:80 [2001:41d0:a:3171:0:1041:2729:a652]:80> ServerName tutorialspots.com ServerAlias www.tutorialspots.com ServerAdmin webmaster@tutorialspots.com DocumentRoot /var/www/tutorialspots/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/tutorialspots/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost>