3

I am trying to set up symfony on my Ubuntu system. Now as going through the installation tutorial of symfony I found to Create a virtual host for my (to be created) application. I did the same steps as bellow.

httpd.conf

NameVirtualHost 127.0.0.1:9090
Listen 127.0.0.1:9090
<VirtualHost 127.0.0.1:9090>
ServerName www.symfony.jobeet.lcl
DocumentRoot "/home/sfprojects/jobeet/web"
DirectoryIndex index.php
<Directory "/home/sfprojects/jobeet/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf
<Directory "/home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>

And Here is My /etc/hosts file

127.0.0.1   www.symfony.jobeet.lcl

Now I restarts my lampp server and entered www.symfony.jobeet.lcl in my browser it takes me to http://www.symfony.jobeet.lcl/xampp/ this Url. If I try without using virtual host, It works fine. also when I try www.symfony.jobeet.lcl:9090 It works. I expect it should work without giving the port number. Am I doing something wrong ?

ScoRpion
  • 11,364
  • 24
  • 66
  • 89

2 Answers2

4

I have created the simple bash script to simplify the process of new hosts creation. So that you don't have to do anything with config files, etc. Check if you are interested here.

Creating new host is as simple as running a command from terminal $ sudo ./newhost.sh. Then you will be asked to enter desired host name.

dfsq
  • 191,768
  • 25
  • 236
  • 258
  • I am not good at scripting or ubuntu.. Can U xplain me how i can do it. I have copied the script to newhost.sh on my desktop now when i do ./newhosts.sh it says cmd not found – ScoRpion Nov 25 '11 at 07:12
  • First of all make sure newhost.sh file is executable. (then run `$ sudo ./newhost.sh`). You will also need to change WWW_ROOT variable to match your username. – dfsq Nov 25 '11 at 07:33
1

Change this lines

NameVirtualHost 127.0.0.1:9090
Listen 127.0.0.1:9090
<VirtualHost 127.0.0.1:9090>

to

NameVirtualHost 127.0.0.1:80
Listen 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
xmarcos
  • 3,298
  • 2
  • 20
  • 27
  • And What if I want to have 2 Virtual hosts. one on port 8080 and Another on port 9090 – ScoRpion Nov 25 '11 at 06:51
  • Tried To Do But It Dosent Work as well.. I got the bellow List of Errors XAMPP: Error 1! Couldn't start Apache! XAMPP: Starting diagnose... XAMPP: Sorry, I've no idea what's going wrong. XAMPP: Please contact our forum http://www.apachefriends.org/f/ – ScoRpion Nov 25 '11 at 06:55
  • It seems that you have a another server/app listening on port 80 already. If you are using Ubuntu, you probably have Apache already installed and running. – xmarcos Nov 25 '11 at 19:46
  • Regarding different ports, you can have as many VirtualHosts as you want on different ports. Check here http://httpd.apache.org/docs/2.0/en/mod/core.html#namevirtualhost for further details. – xmarcos Nov 25 '11 at 19:46