我试图在 linux 上启动 laravel 项目

问题描述

突然...我的网站发生超时错误。 似乎不是过程不起作用。 我应该如何重新启动项目...

PHP-fpm.conf

$  service apache2 restart
Redirecting to /bin/systemctl restart apache2.service
Failed to restart apache2.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status apache2.service' for details.
[ec2-user@ip-172-31-30-200 laravel6]$ systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           └─PHP-fpm.conf
   Active: Failed (Result: exit-code) since Mon 2021-04-12 09:12:06 ; 1min 48s ago
     Docs: man:httpd.service(8)
  Process: 4123 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited,status=1/FAILURE)
 Main PID: 4123 (code=exited,status=1/FAILURE)
   Status: "Reading configuration..."
.ap-northeast-1.compute.internal systemd[1]: Starting The Apache HTTP Server...
.ap-northeast-1.compute.internal httpd[4123]: (98)Address already in use: AH00072: make_sock: Could not bind to address [::]:80
.ap-northeast-1.compute.internal httpd[4123]: (98)Address already in use: AH00072: make_sock: Could not bind to address 0.0.0.0:80
.ap-northeast-1.compute.internal httpd[4123]: no listening sockets available,shutting down
.ap-northeast-1.compute.internal httpd[4123]: AH00015: Unable to open logs
.ap-northeast-1.compute.internal systemd[1]: httpd.service: main process exited,code=exited,status=1/FAILURE
.ap-northeast-1.compute.internal systemd[1]: Failed to start The Apache HTTP Server.
.ap-northeast-1.compute.internal systemd[1]: Unit httpd.service entered Failed state.
.ap-northeast-1.compute.internal systemd[1]: httpd.service Failed.

$ systemctl restart PHP7.0-fpm.service 
Failed to restart PHP7.0-fpm.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status PHP7.0-fpm.service' for details.
$  systemctl stop httpd
Failed to stop httpd.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status httpd.service' for details.

解决方法

@nuzil 在这里回答,

48)Address already in use: AH00072: make_sock: could not bind to address [::]:80

请编辑 httpd.conf 文件。

/usr/local/etc/httpd/httpd.conf

并替换

Listen 80

Listen 127.0.0.1:80

重启apache

sudo apachectl -k restart
,

也许您尝试在两个配置文件中使用相同的端口,或者在其他服务(如 nginx)上使用的 80 端口。尝试 sudo lsof -n -i :80 | grep LISTEN 检查使用 80 端口的进程。

此外,您错过了执行 sudo 命令的 systemctl 命令。可能是权限问题。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...