Apache(和其他服务)可以在localhost上工作,但不能在IP地址上工作

我的Apache服务器在端口80上正常工作。

当我尝试在端口443上启用SSL时,我可以通过localhost(telnet localhost 443)连接,但不能通过IP地址(telnet xxx.xxx.xxx.xxx 443)连接。

为了找出问题所在,我使用了默认端口80 config并将引用更改为端口443.结果相同。 改回80,它工作正常。

这让我觉得有防火墙问题,而不是配置问题。 但我没有防火墙规则。

此网站还在使用相同Linux版本的虚拟机,在Virtualbox下为12.04 Precise 64位。 我在/ etc / apache2目录下tar并将其放在Amazon EC2实例上,我得到了描述的行为 – 端口80工作,443只有localhost。

我不是专家,但不是新手。 难过半天,想出时间伸手,也许其他人可以帮助/受益。 我错过了一些简单的东西,或者我有什么新的东西要打开443端口?

ports.conf:

NameVirtualHost *:80 Listen 80 Listen 443 

在启用站点的默认-ssl

   ServerName mysite.mydomain.com:443 ... more irrelevant stuff 

请注意,如果我只启用default-ssl并将443更改为80,则可以正常工作

所以,这让我觉得没有Apache配置问题,但有些防火墙问题。 但我没有启用防火墙。

 ubuntu@ip-xx-xx-xx-xx:/etc/apache2/sites-enabled$ sudo iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination 

nmap localhost与IP地址

  sudo nmap -sT -O -PN xx.xx.xx.xx Starting Nmap 5.21 ( http://nmap.org ) at 2013-07-30 13:53 EDT Nmap scan report for ec2-xx-xx-xx-xxx.compute-1.amazonaws.com (xx.xx.xx.xx) Host is up (0.0013s latency). Not shown: 996 filtered ports PORT STATE SERVICE 22/tcp open ssh 25/tcp closed smtp 80/tcp open http 3306/tcp closed mysql Device type: general purpose Running (JUST GUESSING) : Linux 2.6.X (85%) Aggressive OS guesses: Linux 2.6.15 - 2.6.26 (85%) No exact OS matches for host (test conditions non-ideal). OS detection performed. Please report any incorrect results at http://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 9.56 seconds ubuntu@ip-10-68-23-145:/etc/apache2/sites-enabled$ sudo nmap -sT -O -PN localhost 

nmap localhost

  Starting Nmap 5.21 ( http://nmap.org ) at 2013-07-30 13:53 EDT Nmap scan report for localhost (127.0.0.1) Host is up (0.000047s latency). Not shown: 995 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 443/tcp open https 3306/tcp open mysql 9418/tcp open git No exact OS matches for host (If you know what OS is running on it, see http://nmap.org/submit/ ). TCP/IP fingerprint: OS:SCAN(V=5.21%D=7/30%OT=22%CT=1%CU=42076%PV=N%DS=0%DC=L%G=Y%TM=51F7FD9D%P= OS:x86_64-unknown-linux-gnu)SEQ(SP=FD%GCD=1%ISR=10E%TI=Z%CI=Z%II=I%TS=8)OPS OS:(O1=M400CST11NW5%O2=M400CST11NW5%O3=M400CNNT11NW5%O4=M400CST11NW5%O5=M40 OS:0CST11NW5%O6=M400CST11)WIN(W1=8000%W2=8000%W3=8000%W4=8000%W5=8000%W6=80 OS:00)ECN(R=Y%DF=Y%T=40%W=8018%O=M400CNNSNW5%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%A OS:=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0% OS:Q=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=0%S= OS:A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R= OS:Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N% OS:T=40%CD=S) Network Distance: 0 hops OS detection performed. Please report any incorrect results at http://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 12.70 seconds lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 12.04.2 LTS Release: 12.04 Codename: precise 

请检查Amazon EC2上的安全组,如果没有443端口规则,请添加一个。