<SOLVED>setting up multiple virtual hosts

Problems with the Windows version of XAMPP, questions, comments, and anything related.

<SOLVED>setting up multiple virtual hosts

Postby jpjones55 » 28. December 2022 10:33

hell all. New to the forums and trying like....to setup a 2 site virtual host with same ip.

windows 10 pro, xampp v7.4.33 - got xampp setup and working, but I'm trying to setup virtual host for 2 sites using the same ip. Here's how I've set it up so far:
D:/xampp/htdocs/wptng.jpj/public_html/ - all wordpress files go in here
D:/xampp/htdocs/tng.jpj/public_html/ - all tng files go here
my hosts file is this:
Code: Select all
# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
    127.0.0.1      tng.jpj         www.tng.jpj
   127.0.0.1      wptng.jpj      www.wptng.jpj


my httpd-vhosts.conf is this:
Code: Select all
## VHost for TNG
<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "D:/xampp/htdocs/tng.org/public_html"
    ServerName tng.org
    ServerAlias www.tng.org
    ErrorLog "logs/tng.org-error.log"
    CustomLog "logs/tng.org-access.log" common
   <Directory "D:/xampp/htdocs/tng.org/public_html">
</Directory>

</VirtualHost>

## VHost for WPTNG
<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "D:/xampp/htdocs/wptng.org/public_html"
    ServerName wptng.org
    ServerAlias www.wptng.org
    ErrorLog "logs/wptng.org-error.log"
    CustomLog "logs/wptng.org-access.log" common
   <Directory "D:/xampp/htdocs/wptng.org/public_html">
</Directory>

</VirtualHost>


trying to install wordpress I'm trying to get to: http://localhost/wptng.jpj/public_html/wp-admin/install.php but get the Not Found error

Any help or suggestions of what I'm doing wrong would be greatly appreciated
John Paul
Last edited by jpjones55 on 28. December 2022 11:19, edited 1 time in total.
User avatar
jpjones55
 
Posts: 2
Joined: 28. December 2022 10:03
Location: Goose Creek, South Carolina, USA
XAMPP version: 7.4.33
Operating System: Windows 10 Pro x64

Re: setting up multiple virtual hosts

Postby Altrea » 28. December 2022 10:47

Hi,

the Servernames in your httpd-vhosts.conf need to match the Hostnames in your Windows HOSTS file. you configured .org domains in the vhosts, but .jpj domains in your windows hosts file.

After that you can use the domain without localhost on the URL lile http://wptng.jpj/
it would directly access files into the defined DocumentRoot defined in your virtualhost, so no need to use them in the url too. correct url would be
http://wptng.jpj/wp-admin/install.php
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11938
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: setting up multiple virtual hosts

Postby jpjones55 » 28. December 2022 11:10

Altrea, man that did the trick! Thank you for such a quick response and for your expertise and the extra set of eyes!
Thank You for Your Time and Knowledge
John Paul
User avatar
jpjones55
 
Posts: 2
Joined: 28. December 2022 10:03
Location: Goose Creek, South Carolina, USA
XAMPP version: 7.4.33
Operating System: Windows 10 Pro x64

Re: <SOLVED>setting up multiple virtual hosts

Postby Altrea » 28. December 2022 11:36

no prob.
you are very welcome :D
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11938
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 179 guests