6

I made a PHP/MySQL app in my desktop that I access using Apache vhosts (XAMPP). In my host file I added 127.0.0.1 myapp so all I have to type in my browser is http://myapp. How can I access this same webpage but from another computer in the same wifi network?

I've also already allowed port 80 on my firewall for my subnet based on this post. This is my first time doing this so I'm on unfamiliar ground. My computer's ip (the one hosting it) is 192.168.254.100. Here's what my httpd-vhosts.conf file looks like:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot D:/xampp/virtual/myapp/public
    ServerName myapp

    <Directory "D:/xampp/virtual/myapp/public">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
enchance
  • 163
  • 1
  • 1
  • 4

1 Answers1

4

On the other computer you could access it from the ip by doing http://192.168.254.100 or if you want the other computer to be able to just type http://myapp you would need to modify the other computer's hosts file to have an entry of 192.168.254.100 myapp.

Lipongo
  • 291
  • 1
  • 8
  • That doesn't work. Typing the ip _does_ connect but only opens the htdocs folder (localhost folder). Since I'm using virtual hosts, my sites are saved in the folder named 'virtual' (can be named anything). As in my `httpd-vhosts.conf ` file, the path of my site is in `D:/xampp/virtual/myapp/public` not `D:/xampp/htdocs/myapp/public`. Got my directions from this post: [Set up multiple virtual hosts on XAMPP for windows](http://ailoo.net/2008/07/set-up-multiple-virtual-hosts-on-xampp-for-windows/). – enchance Sep 16 '12 at 07:47
  • Did you add the entry to your hosts file for myapp and try using myapp instead of IP? The virtual host may only respond to myapp not the IP due to your configuration if apache. – Lipongo Sep 16 '12 at 13:20
  • Tried what you said...and it worked! Thanks, Lipongo. – enchance Sep 16 '12 at 14:04
  • Pleasure to help. – Lipongo Sep 17 '12 at 14:00
  • I want to access from my mobile devices and they dont have that configuration – D4ITON Apr 17 '22 at 15:29