Apache 不断解析或重定向?至localhost
。
分配的 IP192.168.0.145
可解析/重定向至localhost
LAN 中的任何机器。
什么原因造成这种情况?
细节:
我在 virtualbox 上通过桥接连接运行 apache。
如果我在 VirtualBox 中尝试,则该网站已提供服务。
ifconfig && nmap 192.168.0.145 && ufw status && cat /etc/hosts && telnet 192.168.0.145 80
eth0 Link encap:Ethernet HWaddr 08:00:27:5c:db:ba
inet addr:192.168.0.145 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe5c:dbba/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7461 errors:0 dropped:0 overruns:0 frame:0
TX packets:4311 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8579694 (8.5 MB) TX bytes:836980 (836.9 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:4437 errors:0 dropped:0 overruns:0 frame:0
TX packets:4437 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:469630 (469.6 KB) TX bytes:469630 (469.6 KB)
Starting Nmap 5.21 ( http://nmap.org ) at 2014-09-25 20:31 CDT
Nmap scan report for jimjamshimshams.com (192.168.0.145)
Host is up (0.0000070s latency).
Not shown: 999 closed ports
PORT STATE SERVICE
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 0.07 seconds
Status: active
To Action From
-- ------ ----
80 ALLOW Anywhere
80 ALLOW Anywhere (v6)
127.0.0.1 localhost
127.0.1.1 bob-VirtualBox
192.168.0.145 jimjamshimshams.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Trying 192.168.0.145...
Connected to 192.168.0.145.
Escape character is '^]'.
quit
Connection closed by foreign host.
和netstat -tlnp
:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 995/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1019/apache2
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 1051/dnsmasq
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 726/cupsd
tcp6 0 0 ::1:631 :::* LISTEN 726/cupsd
access.log
尝试从 LAN 上的另一台计算机连接后:
192.168.0.119 - - [25/Sep/2014:20:55:19 -0500] "GET / HTTP/1.1" 302 341 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0"
192.168.0.119 - - [25/Sep/2014:20:56:55 -0500] "help" 302 0 "-" "-"
192.168.0.119 - - [25/Sep/2014:20:59:34 -0500] "GET / HTTP/1.1" 302 341 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0"
apache2ctl -S
:
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server 192.168.0.145 (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost 192.168.0.145 (/etc/apache2/sites-enabled/000-default:1)
Syntax OK
答案1
好吧,明白了。
这句话access.log
提示了我:
192.168.0.119 - - [25/Sep/2014:20:56:55 -0500] "help" 302 0 "-" "-"
Apache 正在被我尝试安装的应用程序 (Magento) 重定向。
我必须base_url
在数据库中编辑,因为它被设置为localhost
。