所以我运行这个命令:
/etc/init.d/apache2 start
它说:
* Starting web server apache2 [ OK ]
但! 我的网站仍然没有拉起来。 和!
service --status-all [ - ] apache2
Whaattt ….? 发生了什么事? (
[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!
在Linux上,这通常是由于高ThreadsPerChild +高或无限的ulimit -s。
在Linux上,每个线程的默认堆栈大小为ulimit -s值或8-10兆字节 – 在正常使用情况下,Apache需要大约512KB的堆栈空间或更less。
这很快超过了32位地址空间的大小,TPC接近200+,或者如果你有系统内存的限制,你也可以和它们发生冲突。
在apachectl附带的“envvars”文件中设置ulimit -s 512 – 注意ThreadStackSize在这里没有帮助,因为它设置了最小值。
这是一个新的安装,还是以前是稳定的,不能开始备份?
应该显示“(12)无法分配内存:apr_thread_create:无法创build工作线程”的内存不足。
在您的操作系统中,您更有可能超过了PTHREAD_THREADS_MAX设置。 你可以增加它,或者降低Apache中的ThreadsPerChild。
你很可能使用Apache的“Worker”发行版,“prefork”可能更合适,因为它使用每个进程1个线程,而每个进程使用多个线程的“worker”。
资料来源:
看看日志,特别是error_log。 这应该有所帮助。 如果没有帮助,请尝试使用apache2命令:
strace -f -o output.txt /etc/init.d/apache2 start
strace将跟踪系统调用(-f标志顺序跟随subprocess以及-o标志将输出写入文件output.txt)