Syndicate content

User Loggedin

Welcome to Gujarat Hosting

How To Create VirtualHost in Ubuntu??

Very easy to create VirtualHost in Ubuntu :

1. Open the new file in the /etc/apache2/sites-available/your-domain-name.com

2. Open file

vim /etc/apache2/sites-available/your-domain-name.com

3. Copy below content in that file

***********************************

ServerAdmin webmaster@tejas.com
DocumentRoot /var/www/path-to-your-site-root-dir
ServerName your-domain-name.com
ServerAlias www.your-domain-name.com

#Options Indexes FollowSymLinks MultiViews
#AllowOverride all
#Order allow,deny
#allow from all

# Enable expirations.
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
ExpiresByType text/css A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/pdf A2592000
ExpiresByType text/html A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/x-shockwave-flash A2592000

ErrorLog /var/log/apache2/your-domain-name-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/your-domain-name-access.log combined

**************************************

4. Save this file

5. Run this command

a2ensite your-domain-name.com

6. Restart apache2 service /etc/init.d/apache2 restart

7. Open /etc/hosts file and add this line

127.0.0.1 your-domain-name.com

8. Open url in the browser http://your-domain-name.com