Вопрос

I have already tried port forwarding through router and also disabled my firewall. I also edited httpd.conf. There I changed

Listen 80

to

Listen 8080

I also changed ServerName from localhost:80 to <private-ip>:80 i.e 192.168.1.2:80. Finally I changed to

Order Allow,Deny
Allow from all

in offlineonline tag. I have DLink DSL-2730U. In that in advanced settings> NAT > external port start 8080 and end 8080> internal port start 8080 and end 8080>Server ip i kept as 192.168.1.2 Then restarted all the sevices i.e both router and wamp. But still i am unable to access wamp through my public ip which is 59.95.81.56.

Это было полезно?

Решение

It should have been a simple case of left clicking the WAMPManager menu and clicking Put online.

What that would have done is changed this section of httpd.conf from this:

If using Apache 2.2.x

#   onlineoffline tag - don't remove
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1 ::1 localhost

To this:

#   onlineoffline tag - don't remove
    Order Allow,Deny
    Allow from all

If using Apache 2.4.x

#   onlineoffline tag - don't remove
    Require local

To this:

#   onlineoffline tag - don't remove
    Require all granted

And strictly thats all you should have needed to do!

But as you have done some manual messing with httpd.conf here are some things you need to check. I am assuming you wanted to change the port to 8080 rather than thinking you had to for some reason. If you didnt want to change port number to 8080 then use 80 in the following info instead of 8080. Changing to 8080 just makes life more complicated for your users, but if this is just a play site that does not really matter I suppose.

httpd.conf

# as your router probably does not support IPV6 change so apache only listens on IPV4
# you dont need to put the actual ip address of this PC in here as you say you did.

Listen 0.0.0.0:8080

# ServerName port need to match the Listen, your question made me think you may have left this as localhost:80
ServerName localhost:8080

If using Apache 2.2.x

# Assuming your site is in c:\wamp\www ( this section should already exist I just removed all the comments for brevity)
<Directory "d:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all

    #
    # Controls who can get stuff from this server.
    #
#   onlineoffline tag - don't remove
    Order Allow,Deny
    Allow from all
</Directory>

If using Apache 2.4.x

# Assuming your site is in c:\wamp\www ( this section should already exist I just removed all the comments for brevity)
<Directory "d:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all

    #
    # Controls who can get stuff from this server.
    #
#   onlineoffline tag - don't remove
    Require from all
</Directory>

If you made the common mistake of changing this section, change it back to this, or you will be giving access to your C:\ to anybody.

If using Apache 2.2.x

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order Deny,Allow
    Deny from all
</Directory>

If using Apache 2.4.x

<Directory />
    Options FollowSymLinks
    Require all denied
</Directory>

I hope something in here makes you stumble upon your mistake or ommission.

EDIT: Additional info

phpMyAdmin is protected from prying eyes like this:

edit c:\wamp\alias\phpmyadmin.conf

Alias /phpmyadmin "d:/wamp/apps/phpmyadmin3.5.1/"

# to give access to phpmyadmin from outside
# replace the lines
#
#        Order Deny,Allow
#   Deny from all
#   Allow from 127.0.0.1
#
# by
#
#        Order Allow,Deny
#   Allow from all
#

<Directory "d:/wamp/apps/phpmyadmin3.5.1/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

See the line Allow from 127.0.0.1 that stops anyone not on the same PC as the database using it.

So if you are trying to access that from the internet, it wont work.

I suppose you could TEMPORARILY change it to :

Order Allow,Deny
Allow from all

Or better still if you know the ip address of where you are going to test it from you coudl do

Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1 localhost
Allow from xxx.yyy.zzz.aaa

Where xxx.yyy.zzz.aaa is your friends IP address.

Другие советы

I got the answer at here.

The part I missed in other solution was the Configurtion below:

Configuring the server to be reachable by everyone

The last step! Open your httpd.conf and find this line:

ServerName localhost:80

Change it to:

ServerName <your private IP>:80

Example:

ServerName 192.168.1.27:80

Additionally to RiggsFolly's answer you can open a port in your firewall instead of disabeling it.

The Firewall protects you from many things and disabeling it will make your computer much more vulnerable to hacks

Open port in Windows Firewall

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top