2

I have two different PHP application running on XAMPP server.

I need to be able to access both application using two different domain.

The first application will be local to the server "dev.app". The second app will be accessible from the internal network "staging.domain.com"

The internal IP for the server is 10.0.4.18.

In the httpd.conf I added the following line to run XAMPP on 10.0.4.18

Listen 10.0.4.18:80

Additionally, in the httpd-vhosts.conf I added the following code

#Staging
<VirtualHost *:443>

    DocumentRoot "F:/xampp/htdocs/staging"
    ServerAdmin mikea@domain.com
    ServerName staging.domain.com
    ServerAlias staging.domain.com

    SSLEngine On
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"

    <Directory "F:/xampp/htdocs/staging">
        AllowOverride All
        Require all Granted
    </Directory>

</VirtualHost>

#dev
<VirtualHost *:443>

    DocumentRoot "F:/xampp/htdocs/dev/public"
    ServerAdmin mikea@domain.com
    ServerName dev.app
    ServerAlias dev.app

    SSLEngine On
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"

    <Directory "F:/xampp/htdocs/dev/public">
        AllowOverride All
        Require all Granted
    </Directory>

</VirtualHost>

My hosts file looks like this

127.0.0.1        localhost
127.0.0.1        127.0.0.1
10.0.4.18        dev.app

However, when I open "dev.app" from the local server's browser, it redirects me to staging.domain.com.

How can I be able to access both domain without interfering?

Junior
  • 11,602
  • 27
  • 106
  • 212
  • instead of the `` make it ``. Essentially the first one is just matching all domains (or if reverse, the last one is overwriting the config for the first because it is set to the same match). – Jonathan Kuhn Oct 08 '15 at 21:48
  • @JonathanKuhn still the same problem. I get redirected to staging.domain.com when I try to open dev.app – Junior Oct 08 '15 at 21:51
  • Oops, sorry, that is usually for IP, not domain. Looking over the manual, your original configuration should work fine. Are you restarting apache when you make these changes? – Jonathan Kuhn Oct 08 '15 at 22:00
  • I do restart the server yet. does it make any difference here that I am using port 443 ssl not 80 – Junior Oct 08 '15 at 22:03
  • 1
    It actually might. You would need to access the server with `https` and likely have setup an ssl certificate. – Jonathan Kuhn Oct 08 '15 at 22:04
  • 1
    aha. yes that worked. I had to do https://dev.app for it to work. thank you – Junior Oct 08 '15 at 22:05

0 Answers0