| 
					 1  | 
						sudo apt-get update  | 
					
| 
					 1  | 
						sudo apt-get install -y apache2  | 
					
Installing PHP 5.x
| 
					 1  | 
						sudo apt-get install -y python-software-properties software-properties-common  | 
					
| 
					 1  | 
						sudo add-apt-repository ppa:ondrej/php5-5.6  | 
					
| 
					 1  | 
						sudo apt-get update  | 
					
| 
					 1  | 
						sudo apt-get install -y php5 php5-cgi php5-cli php5-mcrypt php5-curl php5-gd libapache2-mod-php5  | 
					
Enable Apache Rewrite and Userdir Module
| 
					 1  | 
						sudo a2enmod rewrite  | 
					
| 
					 1  | 
						sudo a2enmod userdir  | 
					
| 
					 1  | 
						sudo service apache2 restart  | 
					
Edit Apache userdir configuration
| 
					 1  | 
						nano /etc/apache2/mods-available/userdir.conf  | 
					
Full config look’s like this :
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  | 
						<IfModule mod_userdir.c> 	UserDir public_html 	UserDir disabled root 	UserDir enabled alok 	<Directory /home/*/public_html> 		DirectoryIndex index.php index index.html default.html default.htm 		AllowOverride FileInfo AuthConfig Limit Indexes 		Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec 		<Limit GET POST OPTIONS> 			Require all granted 		</Limit> 		<LimitExcept GET POST OPTIONS> 			Require all denied 		</LimitExcept> 	</Directory> </IfModule>  | 
					
Enable Userdir for PHP5
| 
					 1  | 
						nano /etc/apache2/mods-available/php5.conf  | 
					
Create configuration like this :
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25  | 
						<FilesMatch ".+\.ph(p[345]?|t|tml)$">     SetHandler application/x-httpd-php </FilesMatch> <FilesMatch ".+\.phps$">     SetHandler application/x-httpd-php-source     # Deny access to raw php sources by default     # To re-enable it's recommended to enable access to the files     # only in specific virtual host or directory     Require all denied </FilesMatch> # Deny access to files without filename (e.g. '.php') <FilesMatch "^\.ph(p[345]?|t|tml|ps)$">     Require all denied </FilesMatch> # Running PHP scripts in user directories is disabled by default #  # To re-enable PHP in user directories comment the following lines # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it # prevents .htaccess files from disabling it. #<IfModule mod_userdir.c> #    <Directory /home/*/public_html> #        php_admin_flag engine Off #    </Directory> #</IfModule>  | 
					
Create a new user
| 
					 1  | 
						sudo useradd -d /home/john -m john  | 
					
| 
					 1  | 
						sudo passwd john  | 
					
| 
					 1  | 
						mkdir /home/john/public_html  | 
					
Grant permission
| 
					 1  | 
						sudo chown -R $USER:$USER /home/john/public_html  | 
					
| 
					 1  | 
						sudo chmod -R 775 /home/john/public_html  | 
					
| 
					 1  | 
						cp /var/www/html/index.html /home/john/public_html/index.html  | 
					
Create Virtual host for John’s
| 
					 1  | 
						nano /etc/apache2/sites-available/john.com.conf  | 
					
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  | 
						<VirtualHost *:80> 	ServerName john.com 	ServerAlias www.john.com 	ServerAdmin john@gmail.com 	DocumentRoot /home/john/public_html 	LogLevel warn 	#ErrorLog ${APACHE_LOG_DIR}/error.log 	#CustomLog ${APACHE_LOG_DIR}/access.log combined 	<Directory "/home/john/public_html"> 		Options Indexes FollowSymLinks Includes ExecCGI 		AllowOverride All 		Allow from all 	</Directory> </VirtualHost>  | 
					
Enable Apache virtual host
| 
					 1  | 
						a2ensite john.com.conf  | 
					
| 
					 1  | 
						nano /etc/hosts  | 
					
| 
					 1  | 
						188.166.250.41 www.john.com john.com  | 
					
Restart Apache Configuration
| 
					 1  | 
						service apache2 restart  | 
					
Test a new site
open your web browser and navigate to john.com, if you’re successfull default apache2 will be show on your browser! Okay that’s its.