Mat*_*ato 31 debian apache-httpd
我需要在我的 Debian 7 服务器上运行 Apache2。但它只能在 tcpv6 端口上运行,而不能在 tcpv4 端口上运行。我用 apt-get install 安装了它。如果我访问 localhost 或 127.0.0.1 或我的服务器 IPv4 地址,它不会显示任何网站。
我的/etc/apache2/ports.conf:
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
Run Code Online (Sandbox Code Playgroud)
netstat -plntu:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3558/sshd
tcp 0 0 0.0.0.0:3466 0.0.0.0:* LISTEN 2820/mysqld
tcp6 0 0 :::80 :::* LISTEN 2097/apache2
tcp6 0 0 :::22 :::* LISTEN 3558/sshd
Run Code Online (Sandbox Code Playgroud)
rob*_*at2 41
netstat 在这里只显示 tcp6 的事实不是问题。如果您没有指定要侦听的地址,apache 将使用单个套接字侦听所有支持的地址族(出于设计原因,sshd 对每个地址和地址族使用唯一的套接字,因此在 netstat 输出中出现两次)。
这是我的一个系统,显示 apache 只有 tcp6 套接字,但仍然可以通过 IPv4 和 IPv6 正常工作。
woodpecker ~ # netstat -anp |grep apache
tcp6 0 0 :::80 :::* LISTEN 1637/apache2
tcp6 0 0 :::443 :::* LISTEN 1637/apache2
woodpecker ~ # wget http://127.0.0.1/ -O /dev/null
--2013-12-25 08:52:38-- http://127.0.0.1/
Connecting to 127.0.0.1:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 45 [text/html]
...
# wget http://[::1]/ -O /dev/null
--2013-12-25 08:53:00-- http://[::1]/
Connecting to [::1]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 45 [text/html]
...
Run Code Online (Sandbox Code Playgroud)
如果你wget http://127.0.0.1/ -O -在服务器上运行会发生什么?是否连接成功?它是否按预期返回您网站的原始 HTML?
小智 6
这将仅处理 IPV4 连接:
Listen 0.0.0.0:80
Listen 192.0.2.1:80
Run Code Online (Sandbox Code Playgroud)
https://httpd.apache.org/docs/2.2/bind.html#ipv6
| 归档时间: |
|
| 查看次数: |
109951 次 |
| 最近记录: |