VHOSTS and multiple IP's
Posted by: voicu.alex (---.orangero.net)
Date: May 07, 2019 10:11AM

Hi guys

I have some projects in work and i already installed WAMP server. Also i added some IP's aliases on my network card. My ip's are from C class... such as 192.168.100.x to 192.168.100.y
I want to have a virtual host for every project bind to an IP... something like that: project1 -> vhost1-> ip1 -> port 80

For example:

<VirtualHost 192.168.100.10:80>
ServerName project1
ServerAlias project1
DocumentRoot "d:/projects/project1"
<Directory "d:/projects/project1/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

When i defined my virtual hosts using wamp my hosts file was overwritten. Can you add an option to be backuped, before to be modified? Or just simply, to add the new definitions at the end of the file?

Best regards
Alex

Options: ReplyQuote
Re: VHOSTS and multiple IP's
Posted by: RiggsFolly (Moderator)
Date: May 07, 2019 11:35AM

Why do you need additional IP Addresses.

Just create as many Virtual Hosts as you like, as long as the ServerName is different you can have 100's.

If you use the link "Add a Virtual Host" on the WAMPServer homepage (localhost) then almost all the work is done for you, all you need to do is create the actual folder you want to be the DocumentRoot and then run "Add a Virtual Host"

---------------------------------------------------------------------------------------------
(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: VHOSTS and multiple IP's
Posted by: Otomatic (Moderator)
Date: May 07, 2019 01:18PM

Hi,

> wamp my hosts file was overwritten.

No, new ServerName are added at the end of the hosts file by add_vhosts.php

And if the hosts file does not contain '127.0.0.0.1 localhost' or '::1 localhost', it is opened by:
$fp = fopen($c_hostsFile, 'r+b');
so:
r+' Open for reading and writing; place the file pointer at the beginning of the file.
And the missing information will be inserted at the beginning of the file.

Anyway, Wampserver 3.1.9 will save the hosts file in hosts_wampsave.x files before each rewrite of the file.

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

Options: ReplyQuote


Sorry, only registered users may post in this forum.