Unable to Connect in Multiple Domains using WAMPSERVER
Posted by: mety (112.198.55.---)
Date: January 30, 2017 04:41AM

This is my configuration

Domain 1

<VirtualHost *:80>
ServerAdmin adminemail
DocumentRoot "c:/wamp/www/"
ServerName localhost
ServerAlias localhost
#ErrorLog "logs/error.log"
#CustomLog "logs/access.log" common
<Directory "c:/wamp/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerAdmin adminemail
DocumentRoot "c:/wamp/www/domain1"
ServerName domain1.com
ServerAlias www.domain1.com
#ErrorLog "logs/error.log"
#CustomLog "logs/access.log" common
<Directory "c:/wamp/www/domain1">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>



====================
Domain 2

<VirtualHost *:80>
ServerAdmin adminemail
DocumentRoot "c:/wamp/www/"
ServerName localhost
ServerAlias localhost
#ErrorLog "logs/error.log"
#CustomLog "logs/access.log" common
<Directory "c:/wamp/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerAdmin adminemail
DocumentRoot "c:/wamp/www/domain1"
ServerName domain2.com
ServerAlias www.domain2.com
#ErrorLog "logs/error.log"
#CustomLog "logs/access.log" common
<Directory "c:/wamp/www/domain2">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>



HOST File

127.0.0.1 domain1
::1 domain1

127.0.0.1 domain2
::1 domain2


============

WHen I browse on my network domain1.com work well, it response well, but when I browse domain2.com it says "Unable to Connect".

What part did I missed in my configuration..

Please help me

Thank you



Edited 2 time(s). Last edit at 01/30/2017 08:49AM by mety.

Options: ReplyQuote
Re: Unable to Connect in Multiple Domains using WAMPSERVER
Posted by: RiggsFolly (Moderator)
Date: January 30, 2017 09:59AM

Hi

Why have you got localhost defined twice? Define a Virtual host only once.

<VirtualHost *:80>
  DocumentRoot "c:/wamp/www/"
  ServerName localhost
  ServerAlias localhost
  <Directory "c:/wamp/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot "c:/wamp/www/domain1"
  ServerName domain1.com
  ServerAlias www.domain1.com
  <Directory "c:/wamp/www/domain1">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>




<VirtualHost *:80>
  # The folder holding each domain should be unique
  # Unless you expressly want to server 2 domains from one folder
  DocumentRoot "c:/wamp/www/domain2"
  ServerName domain2.com
  ServerAlias www.domain2.com
  <Directory "c:/wamp/www/domain2">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

The HOSTS file

127.0.0.1 localhost
::1 localhost


127.0.0.1 domain1
::1 domain1

127.0.0.1 domain2
::1 domain2

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 1 time(s). Last edit at 01/30/2017 11:32AM by RiggsFolly.

Options: ReplyQuote
Re: Unable to Connect in Multiple Domains using WAMPSERVER
Posted by: Otomatic (Moderator)
Date: January 30, 2017 10:33AM

Hi,

ServerName domain2.com has the same DocumentRoot as domain1.com

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Unable to Connect in Multiple Domains using WAMPSERVER
Posted by: RiggsFolly (Moderator)
Date: January 30, 2017 11:31AM

Hi Oto,

Woops I completely missed that!

I will fix my answer.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Unable to Connect in Multiple Domains using WAMPSERVER
Posted by: mety (---.49.144.231.111.pldt.net)
Date: January 30, 2017 02:26PM

Hi sir oto,
I already changed documentroot of domain2 to domain2, but the problem still exist., unable to connect when i browse domain2.

Hi sir rigsfolly,
I declared also the localhost at taught by sir oto..



Edited 1 time(s). Last edit at 01/30/2017 02:32PM by mety.

Options: ReplyQuote
Re: Unable to Connect in Multiple Domains using WAMPSERVER
Posted by: Otomatic (Moderator)
Date: January 30, 2017 05:54PM

Hi,

Do not forget that after modifying the hosts file or the httpd-vhosts.conf file, for the changes to be taken into account by Windows and Apache, you must restart the DNS:
- Right-click Wampmanager icon -> Tools -> Restart DNS

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Unable to Connect in Multiple Domains using WAMPSERVER
Posted by: mety (112.198.55.---)
Date: January 31, 2017 12:16AM

It's already solved sir oto and sir rigsfolly. I forgot to assigned physical IP address to my domain2. I install another LANCARD and assigned IP address that matches to the IP address assigned in domain2.com.

Thank you sir



Edited 2 time(s). Last edit at 01/31/2017 02:16AM by mety.

Options: ReplyQuote


Sorry, only registered users may post in this forum.