nginx & wordpress gives 500 pages

Discussion in 'Server Operation' started by EckyBrazz, Oct 21, 2012.

  1. EckyBrazz

    EckyBrazz Member

    Hi,

    My server is running fine, but this weekend I have goto some trouble with nginx. All pages with wordpress are giving me a 500 code, If I make a simple php info it works for that domain.
    I do have domains with joomla, running fine.
    But wordpress is driving me mad now.

    /var/log/nginx
    Code:
    187.58.26.174 - - [21/Oct/2012:15:51:47 -0200] "GET /keepalive.php HTTP/1.1" 200 37 "https://vecks.com.br:8080/index.php" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0"
    127.0.0.1 - - [21/Oct/2012:15:52:01 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:15:53:01 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:15:54:02 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:15:55:01 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:15:55:01 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:15:55:02 -0200] "GET / HTTP/1.1" 500 186 "-" "Wget/1.13.4 (linux-gnu)"
    127.0.0.1 - - [21/Oct/2012:15:56:01 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:15:57:01 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:15:58:01 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:15:59:01 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:16:00:01 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:16:00:03 -0200] "GET / HTTP/1.1" 500 186 "-" "Wget/1.13.4 (linux-gnu)"
    127.0.0.1 - - [21/Oct/2012:16:00:11 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:16:01:01 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    127.0.0.1 - - [21/Oct/2012:16:02:01 -0200] "GET / HTTP/1.1" 500 186 "-" "Mozilla/5.0 (ISPConfig monitor)"
    
    Config files :
    nginx.conf
    Code:
    user www-data;
    worker_processes 8;
    pid /var/run/nginx.pid;
    #worker_rlimit_nofile 10240;
    
    events {
            worker_connections 768;
            # multi_accept on;
    }
    
    http {
            fastcgi_cache_path /var/cache/nginx2 levels=1:2 keys_zone=microcache:5m max_size=1000m;
            log_format cache '$remote_addr - $remote_user [$time_local] "$request" '
            '$status $upstream_cache_status $body_bytes_sent "$http_referer" '
            '"$http_user_agent" "$http_x_forwarded_for"';
    
            ##
            # Basic Settings
            ##
            send_timeout 10m;
            client_max_body_size 20M;
            sendfile on;
            tcp_nopush off;
            tcp_nodelay on;
            keepalive_timeout 65;
            #multi_accept     on;
            types_hash_max_size 2048;
            server_tokens off;
    
            # server_names_hash_bucket_size 64;
            # server_name_in_redirect off;
             ## Detect when HTTPS is used
            map $scheme $fastcgi_https {
              default off;
              https on;
            }
            include /etc/nginx/mime.types;
            default_type application/octet-stream;
    
            ##
            # Logging Settings
            ##
    
            access_log /var/log/nginx/access.log;
            error_log /var/log/nginx/error.log;
    
            ##
            # Gzip Settings
            ##
    
    gzip on;
            gzip_disable "msie6";
    
            gzip_vary on;
            gzip_proxied any;
            gzip_comp_level 6;
            gzip_buffers 16 8k;
            gzip_http_version 1.1;
            gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    
            ##
            # nginx-naxsi config
            ##
            # Uncomment it if you installed nginx-naxsi
            ##
    
            #include /etc/nginx/naxsi_core.rules;
    
            ##
            # nginx-passenger config
            ##
            # Uncomment it if you installed nginx-passenger
            ##
    
            #passenger_root /usr;
            #passenger_ruby /usr/bin/ruby;
    
            ##
            # Virtual Host Configs
            ##
    
            include /etc/nginx/conf.d/*.conf;
            include /etc/nginx/sites-enabled/*;
    #       include /etc/nginx/global/apps.conf;
    }
    /etc/nginx/sites-available/vecks.com.br.vhost

    Code:
    server {
            listen 66.7.217.134:80;
    
    
            server_name vecks.com.br www.vecks.com.br;
    
            root   /var/www/vecks.com.br/web;
    
    
    
            index index.html index.htm index.php index.cgi index.pl index.xhtml;
    
    #       include /etc/nginx/global/wordpress.conf;
    
    
            error_page 400 /error/400.html;
            error_page 401 /error/401.html;
            error_page 403 /error/403.html;
            error_page 404 /error/404.html;
            error_page 405 /error/405.html;
            error_page 500 /error/500.html;
            error_page 502 /error/502.html;
            error_page 503 /error/503.html;
            recursive_error_pages on;
            location = /error/400.html {
                internal;
            }
            location = /error/401.html {
                internal;
            }
            location = /error/403.html {
                internal;
            }
            location = /error/404.html {
                internal;
            }
            location = /error/405.html {
                internal;
            }
            location = /error/500.html {
                internal;
            }
            location = /error/502.html {
                internal;
            }
            location = /error/503.html {
                internal;
            }
    error_log /var/log/ispconfig/httpd/vecks.com.br/error.log;
            access_log /var/log/ispconfig/httpd/vecks.com.br/access.log combined;
    
            ## Disable .htaccess and other hidden files
            location ~ /\. {
                deny all;
                access_log off;
                log_not_found off;
            }
    
            location = /favicon.ico {
                log_not_found off;
                access_log off;
            }
    
            location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
            }
    
            location /stats {
                index index.html index.php;
                auth_basic "Members Only";
                auth_basic_user_file /var/www/clients/client6/web11/.htpasswd_stats;
            }
    
            location ^~ /awstats-icon {
                alias /usr/share/awstats/icon;
            }
    
    location ~ \.php$ {
                    # Setup var defaults
                    set $no_cache "";
    
                    # If non GET/HEAD, don't cache & mark user as uncacheable for 1 second via cookie
                    if ($request_method !~ ^(GET|HEAD)$) {
                        set $no_cache "1";
                    }
    
                    # Drop no cache cookie if need be
                    # (for some reason, add_header fails if included in prior if-block)
                    if ($no_cache = "1") {
                        add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
                        add_header X-Microcachable "0";
                    }
    
                    # Bypass cache if no-cache cookie is set
                    if ($http_cookie ~* "_mcnc") {
                                set $no_cache "1";
                    }
    
                    # Bypass cache if flag is set
                    fastcgi_no_cache $no_cache;
                    fastcgi_cache_bypass $no_cache;
    
                    access_log /var/log/nginx/access.log cache;
    
    fastcgi_cache microcache;
                    fastcgi_cache_key $server_name|$request_uri;
                    fastcgi_cache_valid 404 30m;
                    fastcgi_cache_valid 200 10s;
                    fastcgi_max_temp_file_size 1M;
                    fastcgi_cache_use_stale updating;
                    fastcgi_pass unix:/var/lib/php5-fpm/web11.sock;
                    fastcgi_pass_header Set-Cookie;
                    fastcgi_pass_header Cookie;
                    fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    fastcgi_param  PATH_INFO          $fastcgi_path_info;
                    fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
                    #try_files $uri =404;
                    fastcgi_intercept_errors on;
                    include /etc/nginx/fastcgi_params;
    
                    }
    
    
            # unless the request is for a valid file, send to bootstrap
            if (!-e $request_filename)
            {
                rewrite ^(.+)$ /index.php?q=$1 last;
      }
    
            # Google Analytics Proxy
    #       rewrite ^/ga.js$ /ga/ last;
    #       location /ga/ {
    #               proxy_pass http://www.google-analytics.com/ga.js;
    #               break;
    #       }
    
    }
    
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Which errors do you get in the log file /var/log/ispconfig/httpd/vecks.com.br/error.log ?
     
  3. EckyBrazz

    EckyBrazz Member

    Hi Till.

    I Used another WP domain to show the log files.;

    Code:
    2012/10/07 00:35:04 [error] 2940#0: *709089 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 00:35:04 [error] 2940#0: *709090 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 00:40:04 [error] 2940#0: *709102 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 00:40:04 [error] 2940#0: *709103 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 00:45:04 [error] 2940#0: *709114 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 00:45:05 [error] 2940#0: *709115 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 00:50:04 [error] 2948#0: *709145 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 00:50:04 [error] 2948#0: *709146 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 00:55:04 [error] 2948#0: *709175 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 00:55:04 [error] 2948#0: *709176 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 01:00:04 [error] 2948#0: *709196 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 01:00:05 [error] 2948#0: *709197 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 01:05:05 [error] 2948#0: *709270 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 01:05:05 [error] 2948#0: *709271 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 01:10:05 [error] 2941#0: *709305 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 01:10:05 [error] 2941#0: *709306 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: "G$
    2012/10/07 01:15:04 [error] 2941#0: *709356 open() "/var/www/adlabaredasdefogo.org/web/nginx_status" failed (2: No such file or directory), client: 66.7.217.133, server: adlabaredasdefogo.org, request: 
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Does /var/lib/php5-fpm/web11.sock exist? Did you modify the
    Code:
    location ~ \.php$ {}
    section manually?
     
  5. EckyBrazz

    EckyBrazz Member

    The /var/lib/php5-fpm/web11.sock does not exist

    On one site I modfied on the other it is the normal one that comes with ISPConfig
    location ~ \.php$ {}
     
  6. EckyBrazz

    EckyBrazz Member

    PM sent with link to php info.
     
  7. falko

    falko Super Moderator Howtoforge Staff

    Code:
    location ~ \.php$ {
                    # Setup var defaults
                    set $no_cache "";
    
                    # If non GET/HEAD, don't cache & mark user as uncacheable for 1 second via cookie
                    if ($request_method !~ ^(GET|HEAD)$) {
                        set $no_cache "1";
                    }
    
                    # Drop no cache cookie if need be
                    # (for some reason, add_header fails if included in prior if-block)
                    if ($no_cache = "1") {
                        add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
                        add_header X-Microcachable "0";
                    }
    
                    # Bypass cache if no-cache cookie is set
                    if ($http_cookie ~* "_mcnc") {
                                set $no_cache "1";
                    }
    
                    # Bypass cache if flag is set
                    fastcgi_no_cache $no_cache;
                    fastcgi_cache_bypass $no_cache;
    
                    access_log /var/log/nginx/access.log cache;
    
    fastcgi_cache microcache;
                    fastcgi_cache_key $server_name|$request_uri;
                    fastcgi_cache_valid 404 30m;
                    fastcgi_cache_valid 200 10s;
                    fastcgi_max_temp_file_size 1M;
                    fastcgi_cache_use_stale updating;
                    fastcgi_pass unix:/var/lib/php5-fpm/web11.sock;
                    fastcgi_pass_header Set-Cookie;
                    fastcgi_pass_header Cookie;
                    fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    fastcgi_param  PATH_INFO          $fastcgi_path_info;
                    fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
                    #try_files $uri =404;
                    fastcgi_intercept_errors on;
                    include /etc/nginx/fastcgi_params;
    
                    }
    
    
            # unless the request is for a valid file, send to bootstrap
            if (!-e $request_filename)
            {
                rewrite ^(.+)$ /index.php?q=$1 last;
      }
    This part is not the default ISPConfig PHP configuration. It looks like you have disabled PHP for the website and then added this section to the nginx Directives field, but with PHP disabled there's no PHP-FPM socket.
     
  8. EckyBrazz

    EckyBrazz Member

    PHP is enabled. How else is it possible to show the php info ???
     
  9. EckyBrazz

    EckyBrazz Member

    Sites are working again, dont know why.

    Thanks for helping resolving.
     

Share This Page