Thursday, 24 November 2016

Creating Virtual host in LAMP in Ubuntu

Creating a Virtual host in Ubuntu LAMP with default port 80 for Magento

1) cp /etc/apache2/sites-available/000-default.conf /   /etc/apache2/sites-available/

2) sudo vim

     <VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAlias www.

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/Project_folder
  <Directory /var/www/html/
      Options Indexes FollowSymLinks MultiViews
      AllowOverride all
      Order allow,deny
      allow from all
  # Log file locations

3) sudo service a2ensite

4) sudo service apache reload

5) sudo /etc/init.d/apache2 restart

Notice the symlinked file of in /etc/apache2/sites-enabled folder.

5)  Go to /etc/hosts:
      By default we have as below:

     Add your host name to map the localhost as:

6) In C:\Windows\System32\drivers\etc\hosts

     Add VPN's IP along with host name as :       localhost

7)  Change the value of custom sitename in core_config_data table.

                                                Make sure:

In etc\apache2\apache2.conf configurations for / root directory is as follows

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied

<Directory /usr/share>
    AllowOverride None
    Require all granted

<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

and Virtual host configuration setting is enabled.

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf