Wamp on a network with a domain name

I set up a Wamp server on my local network and it works fine. I can access each project using xxx.xxx.xxx/myproject. But can I configure them for access, such as www.myproject.com or http://myproject.com from the local network . Actually, I am a built-in system programmer, and I have to access my built-in Ethernet boards on different machines. Now it works fine with the IP address, but it's just to know if this is possible.

+4
source share
2 answers

you can do this by setting up virtual hosts and your apache httpd.conf file

configure apache

your apache file will be located in:

  • C: \ WAMP \ Apache2 \ conf \ httpd.conf

find something like:

DocumentRoot 'c:/wamp/www' 

and add the following code after DocumentRoot 'c: / wamp / www' to the file:

 NameVirtualHost 127.0.0.1 <VirtualHost 127.0.0.1> ServerName localhost DocumentRoot 'C:\wamp\www' </VirtualHost> <VirtualHost 127.0.0.1> ServerName yourdomain.com DocumentRoot 'C:\wamp\www\ClientsMyClient' </VirtualHost> 

configure host file

on mac via terminal:

  • sudo nano / etc / hosts

on windows 7:

  • open text editor as administrator
  • open the file and go to:% Systemroot% \ System32 \ Drivers \ Etc

(source: edit hosts file in Windows 7 )

when you opened it, just write a new line to the file:

 XXX.XXX.XXX yourdomain.com (mostly this will be: 127.0.0.1 yourdomain.com) 

I suggest you use yourdomain.local, because if you ever host a website, you may get confused about which one is publicly available and which one is on the local site :).

in your browser you type: yourdomain.com, and you must have a project hosted on a Wamp server with its own domain.

hope this helps !:-)

(source: http://viralpatel.net/blogs/how-to-setup-multiple-virtual-hosts-in-wamp/ )

+4
source

Open C: \ Windows \ system32 \ drivers \ etc \ hosts and after that the localhost address (127.0.0.1) add the domain name you want, for example, www.example.com, and make a space between the IP address and the domain name.

For example, 127.0.0.1 www.example.com

Note. You must open the hosts file in administrator privileges.

0
source

Source: https://habr.com/ru/post/1447938/


All Articles