You are not logged in.

Important Note: This forum is being archived and will be completely locked down on the 7th of February. The new forum can be found at http://laravel.io.

Announcement

    Laravel 4 Advanced Architecture: Book Now On Sale

#1 2012-10-05 13:50:05

sysdba
Artisan
Registered: 2012-07-24
Posts: 70

Ubuntu 12.04 Virtual hosts

Hi, I have installed LAMPP on Ubuntu, how can I set up virtual hosts in Ubuntu, like in Windows on Xampp..
My root is located in /opt/lampp/htdocs/web1, /opt/lampp/htdocs/web2, /opt/lampp/htdocs/web3

Offline

#2 2012-10-05 13:55:36

davzie
Artisan
From: Essex, UK
Registered: 2012-04-14
Posts: 38
Website

Re: Ubuntu 12.04 Virtual hosts

Usually (not sure if LAMPP is different) in Ubuntu, virtual hosts are located at /etc/apache2/sites-available

When you've created a new one, just do a2ensite filename
then
/etc/init.d/apache2 reload
or
service apache2 reload

Offline

#3 2012-10-05 16:27:24

hayden
Artisan
From: Atlanta, GA
Registered: 2012-09-20
Posts: 26

Re: Ubuntu 12.04 Virtual hosts

sysdba wrote:

Hi, I have installed LAMPP on Ubuntu, how can I set up virtual hosts in Ubuntu, like in Windows on Xampp..
My root is located in /opt/lampp/htdocs/web1, /opt/lampp/htdocs/web2, /opt/lampp/htdocs/web3

I have a document that says how to do this step-by-step, would you like for me to post it here?

Offline

#4 2012-10-05 16:34:55

hayden
Artisan
From: Atlanta, GA
Registered: 2012-09-20
Posts: 26

Re: Ubuntu 12.04 Virtual hosts

Here is what I usually do when creating a project in Ubuntu.

1) Create directory

sudo mkdir /var/www/site1.com

2) Change ownership (mainly for Samba file sharing purposes)

sudo chown -R username:username /var/www/site1.com

3) Create VirtualHosts

cd /etc/apache2/sites-available
sudo vi site1.com
<VirtualHost *:80>
    ServerAdmin username@gmail.com
    DocumentRoot /var/www/site1.com/public
    ServerName www.site1.com
    ServerAlias site1.com
</VirtualHost>

4) Enable site1.com

sudo a2ensite site1.com

5) Restart Apache

sudo service apache2 restart

Drop the Laravel files into the /var/www/site1.com folder. You will need to do the following for Laravel to work properly with Ubuntu 12.04...

1) Install prerequisites (Mcrypt is required for Laravel and Rewrite is for getting your VirtualHost file to work properly)

sudo apt-get install php5-mcrypt
sudo a2enmod rewrite 

2) Change permissions of the storage folder

sudo chmod R -777 /var/www/site1.com/storage

3) Restart Apache

sudo service apache2 restart

That should be it! You should now see the Laravel page!

Offline

#5 2012-10-06 00:07:47

HiroKws
Artisan
From: Niigata, Japan
Registered: 2012-05-23
Posts: 306
Website

Re: Ubuntu 12.04 Virtual hosts

Excellent explanation, hayden!

There are all things you must do about virtual host setting.

Maybe it work. If don't work, try to register your computer name ( = domain name ) on /etc/hosts file. It can be edited on super user mode, so use 'sudo...'. You know?

Offline

#6 2013-03-02 22:20:35

atefth
Apprentice
From: Dhaka, Bangladesh
Registered: 2013-03-02
Posts: 3

Re: Ubuntu 12.04 Virtual hosts

Although everything seems fine and all, when I go to my the browser to render my site which is 'project.dev', it just shows me the apache page -

"It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet."

What do you think might be the problem?

Thanks,
Atef Haque,
BRAC University

Offline

Board footer

Powered by FluxBB

');