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.1.8 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 6.3.10>

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: 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.

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.9 32 bit - Apache 2.4.39 - PHP 7.3.5/7.2.18/7.1.29/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.5/7.2.18/7.1.29/7.0.33/5.6.40 - MySQL 5.7.26/8.0.16 - MariaDB 10.3.15
PhPMyadmin 4.8.5 - 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


Sorry, only registered users may post in this forum.