Virtual Servers have I set it all up correctly?
Posted by: jonn0 (---.tpgi.com.au)
Date: April 06, 2019 05:17PM

Hi,
I set up Wamp today, (long day.. lol) and had some issues getting the virtual server working... I've read all the stickies and followed all the instructions I could find. I've installed all the latest versions of everything, including dozens of service packs and redistribution packs.

Windows 10
Apache 2.4.37
PHP 7.2.14
WAMP 3.1.8 64 NTFS
Mysql 5.7.24
Maria DB 10.3.12
Phpmyadmin 4.8.4

I think it's all installed correctly everything seems to be working. I was just wondering if someone might be good enough to take a quick look at vhosts.conf and tell me their opinion. I'm a relative newbie.. :-)

vhosts.conf
# Virtual Hosts
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

#jensmart
<VirtualHost *:80>
   DocumentRoot "c:/wamp64/www/jensmart"
   ServerName jensmart
   <Directory "c:/wamp64/www/jensmart">
      AllowOverride All
      Require local
   </Directory>
</VirtualHost>

#testsite
<VirtualHost *:80>
	ServerName testsite
	DocumentRoot "c:/wamp64/www/testsite"
	<Directory  "c:/wamp64/www/testsite/">
		Options +Indexes +Includes +FollowSymLinks +MultiViews
		AllowOverride All
		Require local
	</Directory>
</VirtualHost>

Thanks for reading
John



Edited 1 time(s). Last edit at 04/06/2019 05:48PM by RiggsFolly.

Options: ReplyQuote
Re: Virtual Servers have I set it all up correctly?
Posted by: RiggsFolly (Moderator)
Date: April 06, 2019 06:03PM

Hi,

Did you find the "Add a Virtual Host" link on the WAMPServer Homepage? Thats a really useful tool for helping to do this.

However, there is nothing really wrong with the 2 VH's you created, I assume by hand.
But honestly, the process is really quite simple. Copy the one that already exists for `localhost` and amend the ServerName and folder where the site code will go.

Suggested amendments, I just used the define variable ${INSTALL_DIR} where it can be, this just makes the file more transportable.

# Virtual Hosts
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
      Options +Indexes +Includes +FollowSymLinks +MultiViews
      AllowOverride All
      Require local
  </Directory>
</VirtualHost>

#jensmart
<VirtualHost *:80>
   DocumentRoot "${INSTALL_DIR}/www/jensmart"
   ServerName jensmart
   <Directory "${INSTALL_DIR}/www/jensmart/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
   </Directory>
</VirtualHost>

#testsite
<VirtualHost *:80>
	ServerName testsite
	DocumentRoot "${INSTALL_DIR}/www/testsite"
	<Directory  "${INSTALL_DIR}/www/testsite/">
		Options +Indexes +Includes +FollowSymLinks +MultiViews
		AllowOverride All
		Require local
	</Directory>
</VirtualHost>

Now a question, did you also amend your HOSTS file to include these new domainnames?
Without doing this the browser will not be able to find these domain name when you try and use them in the address bar.

C:\windows\system32\driversetc\hosts file should look like this


127.0.0.1 localhost
::1 localhost

127.0.0.1 testsite
::1 testsite

127.0.0.1 jensmart
::1 jensmart

Save the HOSTS file and then refresh the DNS Cache so they are available to be found.

So open a command window (as an administrator), then key this command

ipconfig /dnsflush


The new domians shoudl be ready to go. Alternatively you can just reboot windows, the dns cache is rebuilt as part of the reboot process.

Good luck

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.1.8 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.16>

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 MySQL databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 2 time(s). Last edit at 04/07/2019 02:20PM by RiggsFolly.

Options: ReplyQuote
Re: Virtual Servers have I set it all up correctly?
Posted by: Otomatic (Moderator)
Date: April 06, 2019 06:09PM

Hi,

Just a quick remark.
The Apache documentation requires that the <Directory directive has its path ended with a slash, unlike the DocumentRoot directive whose path must not have a final slash.

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.9 32 bit - Apache 2.4.39 - PHP 7.3.6/7.2.19/7.1.30/7.0.33/5.6.40 - MySQL 5.7.26 - MariaDB 10.3.15
Wampserver 3.1.9 64 bit - Apache 2.4.39 - PHP 7.3.6/7.2.19/7.1.30/7.0.33/5.6.40 - MySQL 5.7.26/8.0.16 - MariaDB 10.3.15
PhPMyadmin 4.9.0.1 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: Virtual Servers have I set it all up correctly?
Posted by: RiggsFolly (Moderator)
Date: April 07, 2019 02:20PM

Hi Oto,

Thanks, I missed that smiling smiley

Edited my answer.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.1.8 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.16>

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 MySQL databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Virtual Servers have I set it all up correctly?
Posted by: jonn0 (---.tpgi.com.au)
Date: April 08, 2019 10:22AM

Thanks very much for your reply Riggs, I've edited the file as per your suggestion and I included the trailing slash, as Oto spotted, (Thanks Oto), for the Directory directive and yes my hosts file is exactly as you show it above .

I do have one more question / observation. At the bottom of my localhost, Wamp, Homepage, where the menus for | Tools | Your Projects | Your Aliases | Your Virtual Hosts |, are, the Projects and Virtual Hosts menu items, read as follows...

Your Projects
..... jensmart
..... testsite
..... Warning: See below

Your Virtual Hosts
..... localhost
..... jensmart
..... testsite

Below the menu items, there is a warning in blue text that reads as follows...
_________________________________________________________

It's a bad idea to add localhost in the url of launching projects. It is best to define VirtualHost in
wamp/bin/apache/apache2.4.37/conf/extra/httpd-vhosts.conf
file and not add localhost in the url.
-------------------------------------------------

do I ignore this warning or how do I fix it.

Appreciate your input.. and yours too Oto... thanks guy's

Regards
John



Edited 1 time(s). Last edit at 04/08/2019 10:31AM by jonn0.

Options: ReplyQuote
Re: Virtual Servers have I set it all up correctly?
Posted by: RiggsFolly (Moderator)
Date: April 08, 2019 10:26AM

Go to the WAMPManager Icon .
Right Click
Select Wamp Settings
Uncheck the option at the bottom of the list called "Add localhost in Url"

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.1.8 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.16>

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 MySQL databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.