简体   繁体   English

在Linux服务器上安装Apache 2

[英]Install Apache 2 on a Linux server

I've modified the listening port to 8080. But when I run 'apachetcl start', the error message still occurs as: 我已将侦听端口修改为8080。但是,当我运行“ apachetcl start”时,错误消息仍会显示为:

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
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.

I've also checked the Apache error log. 我还检查了Apache错误日志。

[Wed Dec 09 12:39:16.457678 2015] [mpm_event:notice]
[pid 96777:tid 139998996637568] AH00489: Apache/2.4.7
(Ubuntu) configured -- resuming normal operations
   [Wed Dec 09 12:39:16.457753 2015] [core:notice] [pid 96777:tid 139998996637568] AH00094: Command line: '/usr/sbin/apache2'

How do I suppress this message? 如何隐藏此消息?

To solve this problem: 解决此问题的方法:

  1. Open /etc/apache2/apache2.conf 打开/etc/apache2/apache2.conf

    TO THE TOP ADD: ServerName localhost 最重要的是:ServerName localhost

    Close now! 现在关闭!

  2. OPEN /etc/apache2/ports.conf 打开/etc/apache2/ports.conf

You will see two 80 or 443 or 8080. Delete one and save... Now 您将看到两个80或443或8080。删除一个并保存...现在

apachetcl start

Or you can do: 或者,您可以执行以下操作:

sudo netstat -ltnp | grep ':80'

sudo kill -9 2242

Then restart apache2 : 然后重新启动apache2

sudo /etc/init.d/apache2 restart

Then start it 然后开始

sudo /etc/init.d/apache2 start

Similar to JM511's response, but in a different order of operations. 与JM511的响应相似,但操作顺序不同。 The method they recommended just had apache2 restarting itself with a new process id and still occupying the port. 他们推荐的方法是让apache2使用新的进程ID重新启动自身,并且仍然占用端口。

sudo etc/init.d/apache2 stop

sudo netstat -ltnp | grep ':80'

sudo kill -9 2178 #killed the process id of the process listening to port 80

sudo opt/bitnami/ctlscript.sh restart apache

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM