LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 709|回复: 9

apache2怎样绑定虚拟网卡(已解决!)

[复制链接]
发表于 2010-6-22 14:25:05 | 显示全部楼层 |阅读模式
我用apache2+mediawiki+mysql把gentoo-wiki安装在自己的笔记本上,平时通过http://127.0.0.1或者网卡的 ... conf,设置Listen 10.0.0.8:80,无网线时仍然无法通过http://10.0.0.8访问本机的ge ... 览gentoo-wiki。
 楼主| 发表于 2010-6-22 18:06:25 | 显示全部楼层
其实原先在ubuntu时也不用tap0虚拟网卡,在不插网线时访问http://127.0.0.1或 http://localhost就行了,现 ... 要怎样设置?
回复 支持 反对

使用道具 举报

发表于 2010-6-22 20:26:51 | 显示全部楼层
难道lo没启动?
/etc/init.d/net.lo start
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-22 21:08:06 | 显示全部楼层
Post by druggo;2098102
难道lo没启动?
/etc/init.d/net.lo start


sudo /etc/init.d/net.lo start
* WARNING:  net.lo has already been started.
zhangzhy@gentoo ~ $ sudo ifconfig
eth0      Link encap:Ethernet  HWaddr 00:03:0d:2f:aa:31  
          inet addr:192.168.1.88  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::203:dff:fe2f:aa31/64 Scopeink
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13033 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13397 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9686890 (9.2 MiB)  TX bytes:1637781 (1.5 MiB)
          Interrupt:5 Base address:0xe800

lo        Link encapocal Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:20421 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20421 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1491849 (1.4 MiB)  TX bytes:1491849 (1.4 MiB)

vbox0     Link encap:Ethernet  HWaddr 02:83:d1:40:13:36  
          inet addr:10.0.0.8  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::83:d1ff:fe40:1336/64 Scopeink
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:8 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

zhangzhy@gentoo ~ $
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-23 14:20:45 | 显示全部楼层
自己顶一下,可别沉了下去!
我以往下乡,不能上网,都是浏览本机apache服务器上的网站内容,怎么现在就不行了呢???
回复 支持 反对

使用道具 举报

发表于 2010-6-23 18:15:23 | 显示全部楼层
是不是 apache 依赖 net.* 的启动,然后实际根本没启动 apache 啊?
你看看进程里面有 apache 没?127.0.0.1 肯定应该是可以的。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-23 19:58:19 | 显示全部楼层
Post by wd_afei;2098355
是不是 apache 依赖 net.* 的启动,然后实际根本没启动 apache 啊?
你看看进程里面有 apache 没?127.0.0.1 肯定应该是可以的。


你说的对,如果不插网线的话,apache2就不能启动。在/etc/init.d/apache2脚本中确实有对net的依赖:
depend() {
        need net
        use mysql logger netmount
#        use mysql dns logger netmount postgresql
        after sshd
}
但我试着把need net注释掉也不能启动apache2.请问楼上的有什么办法没有?谢谢!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-23 20:34:22 | 显示全部楼层
我又试着安装了lighttpd,看了它的启动脚本,里面也有对net依赖的语句,但lighttpd在不插网线的情况下依然能启动web服务。


对了,我现在就用lighttpd取代apache了,感觉不错。不去想apache的事了,谢谢楼上两位朋友的关注!
回复 支持 反对

使用道具 举报

发表于 2010-6-24 09:47:14 | 显示全部楼层
/etc/rc.conf 里面


# Do we allow any started service in the runlevel to satisfy the depedency
# or do we want all of them regardless of state? For example, if net.eth0
# and net.eth1 are in the default runlevel then with rc_depend_strict="NO"
# both will be started, but services that depend on 'net' will work if either
# one comes up. With rc_depend_strict="YES" we would require them both to
# come up.
rc_depend_strict="YES"

改成 no 看看?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-24 10:17:08 | 显示全部楼层
加了rc_depend_strict="NO"还是不行
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表