Access wamp (as web server) // Apache 2.4 // globally

假如想象 提交于 2020-01-06 20:13:59

问题


I want my wamp64 server webpages to can be access globally and not only from my local network.

<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>

Now, if i try to access it from my mobile, there showing an empty (white) page. Same if i put at the url /folder_name

Apache file code here: http://pastebin.com/A7xxiQ6B


回答1:


This section must never be changed Specially if you are allowing the universe into your site, as this protects the root and all sub folders on the drive that Apache is installed on. Standard process is to block access to EVERYTHING which this does, and then only allow access to those folders APache actually needs access to.

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

Change it back to

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

And in this part you are using Apache 2.2 AND Apache 2.4 syntax which normally gets Apache confused. So remove the Apache 2.2 syntax so it should look like this

#   onlineoffline tag - don't remove
   Require all granted

Of course you will also need to Port Forward post 80 on your router.

And the PC running WAMPServer will need to be on a static IP address so that that port forwarding always works.




回答2:


Well, the followings working for me. Figure it out :)

Just add to 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

If you have your httpd.conf as the following

#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>

and C:\wamp64\alias\phpmyadmin.conf

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

You will be able (probably) too see your wamp online.

Please note you have to configure your vhosts from localhost\add_vhost.php for your every project (www/folder_name) and change the C:\wamp64\index.php from

$suppress_localhost = true;

to

$suppress_localhost = false;


来源:https://stackoverflow.com/questions/37630161/access-wamp-as-web-server-apache-2-4-globally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!