Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been kind of thrown into the roll of sys admin at my office and don't really know what I'm doing. I'm running Ubuntu 12.04.

The server for our website is currently running nginx. The site keeps crashing because lots and lots of php-fpm processes keep starting, which is bringing down everything. I've tried googling around to find a solution, I've messed around with the nginx config file, set it so scripts die after 10 seconds of running, but nothing I've found solves the problem.

The only solution that works is to restart the php5-fpm, so I wrote a script that runs every 5 minutes that does this just to get the site up, which seems to be working.

I'm assuming the problem is with nginx and php-fpm, so I figured I'd just not use nginx and install apache(no idea if this is a dumb solution or not).

So, I installed apache and set up the virtualhost. I stop nginx and start apache, but it doesn't run. giving me an error of

"Unable to open logs Action 'start' failed. The Apache error log may have more information."

So I check the logs and all it says is 'Unable to open logs', which really doesn't help me. And now I don't know what to do. I don't know why Apache isn't running and the 'fix' I've implemented is just a bandaid and I need to get this working.

So, to keep this focused, how can I troubleshoot Apache to get it running, when I don't know what the error is? Or, if anyone has any ideas why php-fpm is going crazy, that would help too.

nginx config:

user www-data www-data;
worker_processes  4;
worker_rlimit_nofile 32768;

error_log  /var/log/nginx/error.log;
pid        /var/run/;

#pcre_jit on;

events {
    worker_connections  4096;
    multi_accept on;
    accept_mutex_delay 50ms;
    use epoll;

http {
include       /etc/nginx/mime.types;

log_format main    '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';
index index.php;
access_log  /var/log/nginx/access.log;

sendfile        on;
tcp_nopush     on;
tcp_nodelay        on;
server_tokens off;

limit_conn_zone $binary_remote_addr zone=addr:5m;

client_header_buffer_size 4k;
client_max_body_size 20M;
client_body_buffer_size 128k;
large_client_header_buffers 2 8k;

client_body_timeout 60;
client_header_timeout 60;
send_timeout        60;
keepalive_timeout  10 10;

reset_timedout_connection on;

proxy_buffer_size   128k;
proxy_buffers   4 256k;
proxy_busy_buffers_size   256k;

gzip  on;
gzip_buffers 16 8k;
gzip_comp_level 1;
gzip_http_version 1.1;
gzip_static on;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon application/ font/opentype application/x-font-ttf;
gzip_vary  on;
gzip_disable "msie6";
gzip_min_length 1400;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

ssl_session_cache    shared:SSL:10m;


LockFile ${APACHE_LOCK_DIR}/accept.lock
ServerName localhost


Timeout 300
KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 5

<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0

<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0

<IfModule mpm_event_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0


    AccessFileName .htaccess
    <Files ~ "^\.ht">
        Order allow,deny
        Deny from all
        Satisfy all

DefaultType None

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

# Include module configuration:
Include mods-enabled/*.load
Include mods-enabled/*.conf

Include ports.conf

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\""         vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

Include conf.d/
Include sites-enabled/


; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)

user = www-data
group = www-data

listen = /tmp/fpm.sock

pm = static

pm.max_children = 35
pm.start_servers = 8

pm.min_spare_servers = 1
pm.max_spare_servers = 3

; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;

pm.max_requests = 500

request_terminate_timeout = 10

chdir = /

;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M


server {
    listen [::]:80;

    return 301 $scheme://$request_uri;


server {
listen [::]:80;

limit_conn addr 32;


access_log /var/www/public_html/;
error_log /var/www/public_html/;

root   /var/www/public_html/;

## Deny access based on the User-Agent header.
if ($bad_bot) {
        return 444;

location / {
    try_files $uri $uri/ @rewrites;

location @rewrites {

location ~* /\~mydomain1(.*?)$ {
    rewrite ^ /;

location ^~ /industry-news/ {
    rewrite ^/industry-news/?$ /news permanent;
            rewrite ^/industry-news/headlines\.rss$ /feed permanent;
    rewrite ^/industry-news/-?(.*?)(-)-?[$%]([0-9]+).*?$ /news/$1$2$3 permanent;

            try_files $uri $uri/ @rewrites;

location ^~ /news/ {

location ^~ /category/ {

location ^~ /tag/ {

location ^~ /author/ {

location ^~ /tailored-news-feed {

location ~* contact-us\.htm$ {
    rewrite ^ /contact permanent;

location ~* sitemap-.*\.xml$ {
    rewrite ^ /sitemap.xml permanent;

location ~* \.(eot|woff|svf|ttf)$ {
    valid_referers blocked;
    if ($invalid_referer) { return 444; }

    expires max;
    add_header Cache-Control public;

# Prevents log spam from commonly-accessed files
include global/drop.conf;

# Contains Wordpress-specific restrictions & W3TC Files
include global/wordpress.conf;

    # Linkages & PHP setup
    include global/php.conf;
server {
    listen [::]:80;


    access_log /var/www/public_html/dev.mydomain/log/access.log;
    error_log /var/www/public_html/dev.mydomain/log/error.log;

    root   /var/www/public_html/dev.mydomain/public/;

    location / {
            try_files $uri $uri/ /index.php?$args;

    # Prevents log spam from commonly-accessed files
    include global/drop.conf;

    # Linkages & PHP setup
    include global/php.conf;
share|improve this question
I feel sorry for you. – Lucas Kauffman Nov 27 '13 at 16:52
Can you post your nginx and Apache config files? – squillman Nov 27 '13 at 17:31

You only provided the base nginx and apache config, to really get at the root cause, we'd need the Vhost and other configs. specified by these lines:

include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/

In General this is a VERY broad questions. I'm not sure why you're trying to get Apache HTTPD up instead of fixing the problem you actually have with Nginx and php-fpm. But that error sounds like permissions on the log file are wrong. Should probably be owned by APACHE_RUN_USER (as specified in your config file).

In general this is a good write up for nginx and php-fpm (not mine). And might help you with your original issue. Good Luck!

share|improve this answer
Updated OP with config files. I looked at the link you posted and did what was suggested, but it didn't solve the issue. The reason I figured I would try Apache is because it seems like php-fpm is the issue, so I wanted to try and get away from that. – user850237 Dec 3 '13 at 16:23

I think the Apache may not have access to the directory where basic log files are written, especially error log. But sometimes the error messages are misleading.

  • Check where apache would write logs (should be /var/log/apache2)
  • Check also if apache can write lock and pid file (should be /var/lock and /var/run, respectively)

Start Apache interactively:

sudo su -
. /etc/apache2/envvars
apache2 -e DEBUG

In my case, Apache2 report's:

[Thu Nov 28 10:19:51 2013] [debug] mod_so.c(246): loaded module alias_module
apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
(98)Address already in use: make_sock: could not bind to address
no listening sockets available, shutting down
Unable to open logs

So the Unable to open logs message is misleading.

share|improve this answer
up vote -1 down vote accepted

So it turns out that the problem was a WordPress caching plugin that was installed and running and pretty much killing the server. Once I got rid of that, everything worked fine. Thanks.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.