Apache2没有启动我的Web服务器


8

所以我运行以下命令:

/etc/init.d/apache2 start

它说:

* Starting web server apache2 [ OK ]

但!我的网站仍然没有启动。和!

service --status-all
 [ - ]  apache2

哇...?发生了什么事?;(

[Sat May 01 14:45:18 2010] [warn] pid file /var/run/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
[Sat May 01 14:45:18 2010] [notice] Apache/2.2.11 (Ubuntu) PHP/5.3.2 configured -- resuming normal operations
[Sat May 01 14:45:18 2010] [alert] (11)Resource temporarily unavailable: apr_thread_create: unable to create worker thread
[Sat May 01 14:45:18 2010] [alert] (11)Resource temporarily unavailable: apr_thread_create: unable to create worker thread
[Sat May 01 14:45:20 2010] [alert] No active workers found... Apache is exiting!

4
日志,请!查看“ /var/logs/apache2/error.log”或同一目录中的其他文件。
lajuette 2010年

日志什么也没说。
罗伯特·罗斯

只是为了确保您是以root身份或使用sudo来运行它?即不是普通的用户帐户
David Rickman,2010年

您确定安装完成吗?键入dpkg --configure -a以确保所有文件均已正确配置。
ℝaphink

Answers:


3

在Linux上,这通常是由于ThreadsPerChild高+高或无限制的ulimit -s所致。

在Linux上,每个线程的默认堆栈大小为ulimit -s值或8-10兆字节-在正常使用情况下,Apache所需的堆栈空间约为512 KB或更小。

这会很快超过TPC接近200+的32位地址空间大小,或者如果您有系统内存限制,您也可以违反它们。

在apachectl随附的“ envvars”文件中设置ulimit -s 512 -请注意,ThreadStackSize在这里没有帮助,因为这会设置最小值。


2

这是新安装还是以前稳定且无法启动?

如果出现这种情况,则应显示内存不足,尽管应显示“(12)无法分配内存:apr_thread_create:无法创建工作线程”。

您很有可能超出了操作系统内的PTHREAD_THREADS_MAX设置。您可以增加它,或降低Apache中的ThreadsPerChild。

您可能使用Apache的“ Worker”发行版,“ prefork”可能更合适,因为它每个进程使用1个线程,而“ worker”每个进程使用多个线程。

资料来源:


谢谢!切换prefork为我解决了这个问题。
菲利克斯·弗兰克

1

查看日志,尤其是error_log。那应该有帮助。如果没有帮助,请尝试跟踪apache2命令:

strace -f -o output.txt /etc/init.d/apache2 start

strace将跟踪系统调用(-f标志也命令strace遵循子进程,-o标志将输出写入文件output.txt)


[2010年5月1日星期六14:45:18] [警告] pid文件/var/run/apache2.pid被覆盖-先前Apache运行时不干净的关机?[2010年5月1日星期六14:45:18] [通知]已配置Apache / 2.2.11(Ubuntu)PHP / 5.3.2-恢复正常运行[2010年5月1日星期六14:45:18] [警告](11)资源暂时不可用:apr_thread_create:无法创建工作线程[2010年5月1日14:45:18周六] [警报](11)资源暂时不可用:apr_thread_create:无法创建工作线程
Robert Ross 2010年

strace的输出是什么?最后几行应该有意义...
Marco Ramos
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.