最近在Ubuntu上安装了Apache2。
我在访问显示Apache2已成功安装的页面时遇到了一些麻烦。
正在运行
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
什么都不返回。
运行'service apache2 status'
apache2 is running
如果我在终端中运行'apache2'命令,会给我一个错误列表:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
然而,使用'sudo apache2'给了我这个:
[Tue May 26 11:40:48.514878 2015] [core:warn] [pid 4554] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Tue May 26 11:40:48.514923 2015] [core:warn] [pid 4554] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Tue May 26 11:40:48.514935 2015] [core:warn] [pid 4554] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Tue May 26 11:40:48.514939 2015] [core:warn] [pid 4554] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Tue May 26 11:40:48.514950 2015] [core:warn] [pid 4554] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Tue May 26 11:40:48.519904 2015] [core:warn] [pid 4554] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Tue May 26 11:40:48.519999 2015] [core:warn] [pid 4554] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Tue May 26 11:40:48.520009 2015] [core:warn] [pid 4554] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
不确定这是否与我尝试查找正在运行apache的本地服务器IP的问题有关。
感谢任何帮助或指导!
运行ifconfig后编辑
eth0 Link encap:Ethernet HWaddr 28:d2:44:db:55:6e
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:20 Memory:f0600000-f0620000
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:39387 errors:0 dropped:0 overruns:0 frame:0
TX packets:39387 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4256292 (4.2 MB) TX bytes:4256292 (4.2 MB)
wlan0 Link encap:Ethernet HWaddr 18:cf:5e:be:29:7a
inet addr:10.0.1.15 Bcast:10.0.1.255 Mask:255.255.255.0
inet6 addr: fe80::1acf:5eff:febe:297a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:806787 errors:0 dropped:0 overruns:0 frame:0
TX packets:634100 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:880453718 (880.4 MB) TX bytes:122151075 (122.1 MB)
答案 0 :(得分:0)
1乘1。
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
如果连接确实通过eth0,这只会显示一些内容。运行ifconfig
以查看您正在使用的界面。这也将显示您的机器具有的IP地址。
运行apache2
后出现的错误有很多。
Could not reliably determine the server's
... you can fix that specific one here
接下来三行抱怨套接字是因为apache2已经运行并且无法绑定到端口,因为其他一些进程(正在运行的apache实例)已经绑定到它们。
该块中关于日志的最后一行是因为您将apache2作为非特权用户运行,并且您的日志文件受到保护。
当你用sudo运行apache2时,你遇到了一大堆关于配置变量的错误,因为你试图错误地启动apache。
在启动Apache之前, sudo service apache2 start|stop|restart
会将/etc/apache2/envvars
中的值加载到您的环境中。这是你应该控制apache的方式。