问题
Config:
OS-> Win 7 x64
Wamp server versions-> wampserver2.2e - php5.4.3 - httpd-2.4.2 - mysql5.5.24
Skype is not installed. Port 80 is available.
hosts file has the lines->
127.0.0.1 localhost
::1 localhost
httpd.conf file has the required value `Require all granted` in #onlineoffline tag
Issue:
I need to put my server online (yes I understand the risks but this is a temporary thing that I need to do). I also understand that similar questions have been posted and I have gone through almost all of the them and their solutions (you will find out below).
Problem statement: Wamp icon is Green. Status shows as Online. Everything woks without any hassles using localhost. But the moment I use my public IP I get page cannot be displayed. I have checked the access logs and there doesnt seem to be any log for the time I attempt the access.
Solutions tried: (i guess everything)
- With router I have tried with port forwarding. I have also tried without using the router.
- Tried with Firewall enabled and disabled.
- Tried the "allow" lines.
- Tried install/remove/restart of Apache service
- Tried changing
localhost:80
to<ip>:80
- Tried multiple online/offline toggles
- Tried installing 32 bit variant of version 2.5
- Tried installing 64 but variant of version 2.5
- Tried playing with the spaces before the
Require all granted
code (from none to 2)
Note
Everything used to work in my previous installation of Windows. Post re-installing I can't remember for the life of me the settings I changed to get it to work. I had the backup but that I deleted the moment I saw the green icon (foolish me !). I must have read countless solutions but I'm currently stuck like this person (wamp server forum). Would really really appreciate if anyone could help me resolve this.
Additional info:
<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride All
# onlineoffline tag - don't remove
Require all granted
</Directory>
回答1:
Re: Static IP. That comment was supposed to mean that Your PC running the WAMPServer i.e. Apache should have a static IP, so that when you reboot your PC or your router it always gets the same IP address so that the Port Forwarding from your router to your webserver PC always remains the same and therefore the port forwarding always forwards to the correct PC inside your internal network.
In this section:
<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
# onlineoffline tag - don't remove
Require all granted
</Directory>
You have this statement Require all granted
occuring twice, you only need it once.
Apache 2.4.2 is IPV6 aware so it should be quite happy accepting connections in the IPV6 range.
You could check your Apache Listen
directive, it is possible that you have something like this in the httpd.conf
file
Listen 0.0.0.0:80
The 0.0.0.0
part will tell Apache to only listen on the IPV4 network. If that is the case change it to
Listen 80
So that it listens to both IPV4 and IPV6.
Or
Listen 0.0.0.0:80
Listen [::0]:80
Also does your router support IPV6? If not then any external connections from the IPV6 range will not be accepted by your router, and therefore of course those connections will not make it past your router. Check that your router is IPV6 capable and if it is that you have IPV6 turned on, if it is an optional feature!
回答2:
A simple step it will work:
Change the following property: Require all granted
Now restart all services and access your box from the outside.
回答3:
I just put the onlineoffline tag as a comment and it worked :
# onlineoffline tag - don't remove
Require local
Just get past the warning and comment this one
# onlineoffline tag - don't remove
# Require local
Optional : You can add, just to be sure
Order Allow,Deny
Allow from all
Worked for me with both.
I found the solution thanks to the link at the bottom of this post : How to allow remote access to my WAMP server for Mobile(Android) on the page : https://gist.github.com/samvaughton/6790739
来源:https://stackoverflow.com/questions/25922193/wamp-server-online-but-inaccessible-from-outside