Earthtracker's Blog

Just another WordPress.com weblog

Setup virtual host in ubuntu

Setup virtual host in ubuntu is pretty simple.

Hope you have already apache2 installed.

Now go to the location: /etc/apache2/sites-enabled
Open the file named ‘000-default’ as root.

You will find some line for default localhost .

<VirtualHost *:80>
	ServerAdmin webmaster@localhost
       DocumentRoot /var/www
	<Directory />
		Options FollowSymLinks
		AllowOverride All
	</Directory>
......

Add the following line

ServerName localhost

Now copy the full section between

<VirtualHost *:80></VirtualHost>

under this part .
Change the code like below.

<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	ServerName mydomain.com

	DocumentRoot /var/www/project-folder-name/
	<Directory />
		Options FollowSymLinks
		AllowOverride All
	</Directory>
	<Directory /var/www/project-folder-name/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
	</Directory>

.......... 
</VirtualHost>

Others will remain same.

Save the file.

Now fine the host file from /etc/hosts
Add the following line

127.0.0.1	mydomain.com

Save the file.

Now restart your apache.
sudo /etc/init.d/apache2 restart

Enjoy browsing your new virtual host. 🙂

Leave a comment »

How to enable curl in ubuntu ?

Enable curl in ubuntu is pretty simple.

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
sudo /etc/init.d/apache2 restart
Leave a comment »

Enable mod rewrite in Ubuntu Apache server

To enable mod_rewrite in Apache server in Ubuntu is pretty simple.

sudo a2enmod rewrite
sudo gedit /etc/apache2/sites-enabled/000-default

Edit the file 000-default:

<Directory />
 Options FollowSymLinks
 AllowOverride ALl
 </Directory>
 <Directory /var/www/>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride All
 Order allow,deny
 allow from all
 </Directory>
sudo /etc/init.d/apache2 restart
Leave a comment »