如何使Wamp Server联机? [英] How to bring wamp server online?
问题描述
我已经尝试通过路由器进行端口转发,并且还禁用了防火墙. 我还编辑了httpd.conf.在那里我改变了
Listen 80
到
Listen 8080
我还将ServerName从localhost:80
更改为<private-ip>:80 i.e 192.168.1.2:80.
最后,我更改为
Order Allow,Deny
Allow from all
在离线标签中. 我有DLink DSL-2730U.在高级设置中> NAT>外部端口开始8080和结束8080>内部端口开始8080和结束8080>服务器ip i保持为192.168.1.2 然后重新启动所有服务,即路由器和沼泽. 但是我仍然无法通过我的公共IP(59.95.81.56)访问wamp.
应该是一种简单的情况,只需左键单击WAMPManager菜单,然后单击Put online
.
本该更改的是httpd.conf
的本部分:
如果使用Apache 2.2.x
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1 localhost
对此:
# onlineoffline tag - don't remove
Order Allow,Deny
Allow from all
如果使用Apache 2.4.x
# onlineoffline tag - don't remove
Require local
对此:
# onlineoffline tag - don't remove
Require all granted
严格来说,这就是您应该要做的所有事情!
但是,当您对httpd.conf进行一些手动操作时,需要检查以下内容.我假设您想将端口更改为8080,而不是出于某些原因而认为您必须这样做.如果您不想将端口号更改为8080,请在以下信息中使用80而不是8080.更改为8080只会使用户的生活变得更加复杂,但是我想这只是一个并不重要的播放站点. /p>
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
如果使用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>
如果使用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>
如果您在更改此部分时犯了常见错误,请将其更改回此部分,否则任何人都可以使用C:\.
如果使用Apache 2.2.x
<Directory />
Options FollowSymLinks
AllowOverride None
Order Deny,Allow
Deny from all
</Directory>
如果使用Apache 2.4.x
<Directory />
Options FollowSymLinks
Require all denied
</Directory>
我希望这里的某些内容会让您迷失自己的错误或遗漏.
其他信息
保护phpMyAdmin免受此类窥视:
编辑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>
请参见Allow from 127.0.0.1
行,该行会停止与使用数据库的数据库不在同一台PC上的任何人.
因此,如果您尝试从Internet访问它,它将无法正常工作.
我想您可以暂时将其更改为:
Order Allow,Deny
Allow from all
或者更好,如果您知道如何通过coudl做测试的IP地址
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1 localhost
Allow from xxx.yyy.zzz.aaa
其中xxx.yyy.zzz.aaa是您的朋友IP地址.
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.
这篇关于如何使Wamp Server联机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!