我有一个Windows XP机器,我已经安装了WAMP并创build了一个基于PHP的Web应用程序。 我可以通过使用浏览器并指向: http://localhost/myApp/ —从本机访问Web应用程序,并且页面加载正常。
现在,我希望这个网站( http://localhost/myApp )可以被networking中的所有机器访问(也许以后也可以发布给公众)。 我对此很新,如何让我的网站可以在networking中的所有机器上访问,以及在互联网上的公众?
我试着修改Apache(WAMP)中的httpd.conf文件,将Listen 80改为Listen 10.10.10.10:80 (我用这台windows xp机器的实际IPreplace了10.10.10.10 )。 我也尝试了WAMP中的“在线”function。 但似乎没有工作。
我如何使它可访问?
其实更好的解决方法是:
对于Apache 2.4.x
在httpd.conf文件中find这个部分,这个改变也纠正了使用Apache 2.4新语法的语法。
<Directory "c:/wamp/www"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # # Require all granted # onlineoffline tag - don't remove Order Deny,Allow Deny from all Allow from 127.0.0.1 Allow from ::1 Allow from localhost </Directory>
并改变它
<Directory "c:/wamp/www"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # # This looks after 127.0.0.1 ::1 and localhost Require local # This should be the first 3 quartiles of the standard subnet ipaddress range Require ip 192.168.0 </Directory>
或者如果你还在使用Apache 2.2
改变类似的部分如下
<Directory "d:/wamp/www/"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride all # # Controls who can get stuff from this server. # Order Deny,Allow Deny from all Allow from 127.0.0.1 ::1 localhost # This should be the first 3 quartiles of the standard subnet ipaddress range Allow from 192.168.0 </Directory>
如果你使用Allow from all方法,你实际上允许从任何IP地址访问,甚至外部互联网的。 可能非常危险。