访问wamp(作为Web服务器)// Apache 2.4 //全局访问

时间:2016-06-04 12:20:28

标签: apache webserver wamp global

我希望我的wamp64服务器网页可以全局访问,而不仅仅是从我的本地网络访问。

<Directory />
    AllowOverride none
    Require all granted
</Directory>

<Directory "C:/wamp64/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.
    #

#   onlineoffline tag - don't remove
   Order allow,deny
   Allow from all 
   Require all granted
</Directory>

现在,如果我尝试从我的手机访问它,那么会显示一个空(白色)页面。如果我放在url / folder_name

,则相同

Apache文件代码:http://pastebin.com/A7xxiQ6B

2 个答案:

答案 0 :(得分:0)

此部分绝不能更改特别是如果您允许Universe进入您的站点,因为这会保护安装Apache的驱动器上的根和所有子文件夹。标准流程是阻止对一切进行访问,然后只允许访问APache实际需要访问的那些文件夹。

<Directory />
    AllowOverride none
    Require all granted
</Directory>

将其更改回

<Directory />
    AllowOverride none
    Require all denied
</Directory>

在这部分中,您使用的是Apache 2.2和Apache 2.4语法,这通常会让Apache感到困惑。因此,删除Apache 2.2语法,使它看起来像这样

#   onlineoffline tag - don't remove
   Require all granted

当然,您还需要在路由器上将80后端口转发。

运行WAMPServer的PC需要使用静态IP地址,以便端口转发始终有效。

答案 1 :(得分:0)

嗯,以下为我工作。搞清楚:))

只需添加到C:\ Windows \ System32 \ drivers \ etc \ hosts

# localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost <--  Uncomment this
#   ::1             localhost
    127.0.0.1 xxxxxx.ddns.net <-- Add here your public IP or your Dynamic DNS name

如果您的 httpd.conf 如下

#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80

ServerName xxxxx.ddns.net:80

<Directory "C:/wamp64/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.
    #

#   onlineoffline tag - don't remove
   Require all granted
</Directory>

C:\ wamp64 \ alias \ phpmyadmin.conf

<Directory "C:/wamp64/apps/phpmyadmin4.5.2/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Require all granted
      ..............
</Directory>

你也可以(可能)在网上看到你的傻瓜。

请注意,您必须为每个项目(www / folder_name)配置 localhost \ add_vhost.php 的vhost,并更改 C:\ wamp64 \ index.php 来自

$suppress_localhost = true;

$suppress_localhost = false;