Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Linux服务器上安装Apache2_Linux_Apache - Fatal编程技术网

在Linux服务器上安装Apache2

在Linux服务器上安装Apache2,linux,apache,Linux,Apache,我已将侦听端口修改为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:

我已将侦听端口修改为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.
我还检查了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'
如何抑制此消息?

要解决此问题,请执行以下操作:

  • 打开
    /etc/apache2/apache2.conf

    在顶部添加:ServerName localhost

    快关门

  • 打开
    /etc/apache2/ports.conf

  • 您将看到两个80或443或8080。删除一个并保存。。。现在

    apachetcl start
    
    或者你可以:

    sudo netstat -ltnp | grep ':80'
    
    sudo kill -9 2242
    
    然后重新启动apache2:

    sudo /etc/init.d/apache2 restart
    
    那就开始吧

    sudo /etc/init.d/apache2 start
    

    与JM511的响应类似,但操作顺序不同。他们推荐的方法只是使用一个新的进程id重新启动apache2,并且仍然占用端口

    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
    

    你在哪里把端口换成了8080?在您的日志中,apache尝试连接到端口80。它工作正常!我现在可以在Linux服务器上启动Apache,但仍然无法在windows浏览器上浏览默认html。