I have configured a Wamp server in my local network and it works great. I can access each project with xxx.xxx.xxx/myproject, but, as another option, can I configure them to access like www.myproject.com or http://myproject.com from the local network ? I am an embedded system programmer and I have to access my embedded Ethernet boards with various machines. It works fine with an IP address, but I just want to know if it is possible.
you can do that by configuring your virtual hosts and the httpd.conf file of your apache
configure apache
the file of your apache will be located in:
search for something like:
DocumentRoot 'c:/wamp/www'
and add the following code after the DocumentRoot 'c:/wamp/www' into 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 hostfile
on mac via terminal:
on windows 7:
(source: edit hosts file in windows 7 )
when you have it opened just write a new line into the file:
XXX.XXX.XXX yourdomain.com
(mostly this will be: 127.0.0.1 yourdomain.com)
I do suggest you use yourdomain.local, because if you ever host a website, you might get confused about which one is the public one and which one is the local website :).
in your browser you then type: yourdomain.com and you should be able to have a project hosted on a wamp server, with his own domain.
hope this helps! :-)
(source: http://viralpatel.net/blogs/how-to-setup-multiple-virtual-hosts-in-wamp/ )
Open C:\Windows\system32\drivers\etc\hosts and after that localhost address(127.0.0.1) add the domain name which you want like www.example.com and make a space between ip address and domain name.
For Example, 127.0.0.1 www.example.com
Note: You need to open 'hosts' file in Administrator Privileges .
Open C:\wamp64\bin\apache\apache2.4.46\conf\httpd.conf
Search for something like:
#Virtual hosts
#Include conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-vhosts.conf
Open C:\wamp64\bin\apache\apache2.4.46\conf\extra\httpd-vhosts.conf
Add the following code in the end:
<VirtualHost *:80>
ServerName yourdomain.com
ServerAlias yourdomain.com
DocumentRoot "c:/wamp64/www/somename"
<Directory "c:/wamp64/www/somename/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
127.0.0.1 yourdomain.com
Restart WAMP server
In your browser you then type: yourdomain.com and you should be able to have a project hosted on a wamp server, with his own domain.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.