0

Hello I have a LAMP server setup on an Ubuntu machine and a Zend Framework project.

I made a virtual host in my /etc/apache2/sites-available, enabled it with a2ensite command and everything works great on localhost but I have a problem accessing the application from another computer in my LAN using my IP

If I go to 192.168.x.x/application_name/public (that is where the index.php is) i get the folder listing.

PS: phpmyadmin works (192.168.x.x/phpmyadmin)

Am I missing some configurations?

My virtual host

<VirtualHost *:80>
ServerAdmin xx@localhost
ServerName application.local
ServerAlias www.application.local
DirectoryIndex index.php
DocumentRoot /var/www/application/public/
</VirtualHost>

  • 1
    Do you have an `index.php` file in the directory? Also your virtual host requires you to access it using the name(s) configured in `ServerName` and `ServerAlias` - accessing it by IP won't work unless you add that IP address to the `ServerAlias` directive, which you probably don't want to do. You can create an entry in your [hosts file](http://en.wikipedia.org/wiki/Hosts_(file)) if you don't have it configure in internal DNS. – DaveRandom May 14 '12 at 15:35
  • Hey thanks for the idea. I put the IP address at the ServerAlias and it works. Of course if I have another application in my /var/www/ folder it cannot be accessed but it's no problem so far. I only wanted to test the app from more computers at one time. Thanks again – Cristian Bordei May 16 '12 at 13:52

1 Answers1

2

All you need to do is edit the hosts file on the 2nd machine to add an entry for

192.168.x.x    application.local

where 192.168.x.x is the IP address of the machine with the app on, and application.local matches the value in the ServerName of your vhost. Then just open a browser and go to http://application.local/

Tim Fountain
  • 33,093
  • 5
  • 41
  • 69