I am using ubuntu 13.10 OS and LAMP, Apache 2.4.
I would like to create a virtual host on apache. I tried some code, but it didn't work.
The following modifications are made. but it's not working.
First I changed HostnameLookups off
to HostnameLookups on
on etc\apache2\apache2.conf
file. Then I added the below code,
<VirtualHost *:80>
ServerName local.scholarships.theiet.in
DocumentRoot /home/www/my_project/public_html
<Directory path_to_code_base/public>
Options -Indexes
Require all granted
DirectoryIndex index.php
AllowOverride All
</Directory>
</VirtualHost>
After restart apache I ran http://localhost/
. The site is not loaded.
How can I load my site when running http://localhost/
This is an another way of create a virtual host in ubuntu 13.10
Below example shows how to create a virtual host,
Step 1: create a PHP project named site1.com
on /home/user/www/
Step 2: Change HostnameLookups off
to HostnameLookups on
in /etc/apache2/apache2.conf
Step 3: Create a config file named site1.com.conf
on /etc/apache2/sites-available/
Add this code to site1.com.conf
,
<VirtualHost *:80>
ServerName site1.com
ServerAlias www.site1.com
ServerAdmin info@site1.com
DocumentRoot /var/www/site1.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/site1.com">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Step 4: Then add 127.0.0.1 site1.com
to /etc/hosts.txt
Step 5: Open terminal and run the commands,
sudo a2ensite site1.com
sudo /etc/init.d/apache2 restart
Step 6: Open browser and run http://site1.com/
Try this