Tuesday, November 23, 2010

Configure virtual host on linux to run symfony project

Let's assume you have created your project in /var/www/sfsite.

To create a virtual host for symfony project on Linux follow these steps:

sudo gedit /etc/apache2/sites-available/sfsite.lcl.conf - generate configuration for your new host

insert into file your settings of host:

<VirtualHost *:80>
    ServerName sfsite.lcl
    DocumentRoot "/var/www/sfsite/web"
    DirectoryIndex index.php
    <Directory /var/www/sfsite/web >
        AllowOverride All
    </Directory>
Alias /sf /var/www/symfony/data/web/sf
<Directory "/var/www/symfony/data/web/sf ">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>

sudo a2ensite sfsite.lcl.conf – enable this site for the server

sudo gedit /etc/hosts

insert name of your host, so that your local server knows that it has to look in for your local sites, not on the internet:

127.0.0.1 sfsite.lcl

sudo /etc/init.d/apache2 restart – restart apache server and you can work on your symfony project by typing sfsite.lcl link into your web browser

2 comments:

  1. thx a lot my friend i'm getting started with symfony and i get stuck with this problem. greetings from argentina

    ReplyDelete
  2. I really like your blog.. very good tones and point. Did you make this site yourself or did you enroll someone to do it for you? Plz answer back as I'm expecting to make my own blog and should know where u got this from. great wishes
    analog sports watches
    men analog digital watch

    ReplyDelete