web - Unable to create URL with wampserver [Resolved] -
i trying create url site hosted through wampserver, no matter unable url work. site online because able connect through servers ip address, though.
(i should mention site available on intranet)
hosts file:
# copyright (c) 1993-2009 microsoft corp. # # sample hosts file used microsoft tcp/ip windows. # # file contains mappings of ip addresses host names. each # entry should kept on individual line. ip address should # placed in first column followed corresponding host name. # ip address , host name should separated @ least 1 # space. # # additionally, comments (such these) may inserted on individual # lines or following machine name denoted '#' symbol. # # example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution handled within dns itself. # 127.0.0.1 localhost # ::1 localhost 127.0.0.1 localhost 127.0.0.1 www.socialclub.com #also tried public/private ip, still works locally
vhosts.conf:
# virtual hosts # # required modules: mod_log_config # if want maintain multiple domains/hostnames on # machine can setup virtualhost containers them. configurations # use name-based virtual hosts server doesn't need worry # ip addresses. indicated asterisks in directives below. # # please see documentation @ # <url:http://httpd.apache.org/docs/2.4/vhosts/> # further details before try setup virtual hosts. # # may use command line option '-s' verify virtual host # configuration. # # virtualhost example: # apache directive may go virtualhost container. # first virtualhost section used requests not # match servername or serveralias in <virtualhost> block. # <virtualhost *:80> servername localhost documentroot "e:\data\users apps\wamp\www\socialclub" </virtualhost> <directory "e:\data\users apps\wamp\www\socialclub"> allowoverride order allow,deny allow options indexes followsymlinks includes execcgi </directory> <virtualhost *:80> documentroot "e:\data\users apps\wamp\www\socialclub" servername www.socialclub.com </virtualhost>
every guide i've looked @ says should work, works locally. need url work other computers?
ok think problem not understanding hosts file used , scope is.
the hosts file effects single pc lives on. used seed windows dns cache @ boot time. whatever put in file have no effect on other pc in intranet.
there couple of solutions :
lets assume pc running wampserver has ip address 192.168.1.10:
you go each pc in intranet , make change hosts file on each pc
192.168.1.10 socialclub.com
people think hassle if have more 5-6 pc's mod
you install local dns server, or make use of existing local dns server. long pc's in intranet using dns server add domain name dns server.
people think idea, can quite complicated right , not loose access real dns servers out there on web
a couple of changes suggest httpd-vhost.conf file
first leave localhost pointing original wampserver homepage, allow access pc running wampserver. tools on homepage can useful debug/diagnostics/etc, allow access locahost pc running wampserver.
second put <directory></directory>
block inside virtual host definition. allows make each virtual hosts security specific virtual host.
# should first vhost definition default virtual host # access rights should remain restricted local pc , local network # random ip address attack recieve error code , not gain access <virtualhost *:80> documentroot "c:/wamp/www" servername localhost <directory "c:/wamp/www"> allowoverride require local </directory> </virtualhost> <virtualhost *:80> documentroot "e:\data\users apps\wamp\www\socialclub" servername www.socialclub.com <directory "e:\data\users apps\wamp\www\socialclub"> allowoverride options indexes followsymlinks includes execcgi # assuming subnet equates range # , using apache 2.4.x # not necessary allow access in intranet # in fact might dangerous require ip 192.168.1 </directory> </virtualhost>
Comments
Post a Comment