Dylan Madisetti
Dylan Madisetti

Reputation: 775

Debugging in nGinx yields 1 line and infinite frustration- How to Debug the Debugger

Yay for experimental projects! I decided to try setting up my blog with Facebook's new hhvm-fastcgi and wordpress. Followed instructions and am using the following nGnix configuration:

    server {
        listen *:80 default;
        server_name _;
        access_log /home/blogs/logs/nginx/access.log;
        error_log /home/blogs/logs/nginx/error.log debug;
        location / {
            deny all;
        }
    }

    server {
        listen *:80;
        server_name www.site.com;

        root /home/blogs/wordpress/;
        index index.html index.php index.htm;

        access_log /home/blogs/logs/nginx/site/access.log main;
        error_log /home/blogs/logs/nginx/site/error.log debug;

        # proxy_redirect off;
        set $myuri $request_uri;

        rewrite ^/wp-admin\/a$ /wp-admin/index.php;

        if (!-e $request_filename) {
            rewrite /wp-admin$ $scheme://$host$uri/ permanent;
            rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
            rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
        }

        # Try MemCached First
        location / {
            set            $memcached_key "$uri?$args";
            memcached_pass 127.0.0.1:11211;
            error_page     404 405 502 504 = @fallback;
        }

        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME /home/blogs/wordpress$fastcgi_script_name;
            include        fastcgi_params;
        }

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

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires max;
            log_not_found off;
        }
    }

It would be all too simple if it worked. Hitting the site just causes my browser to hang and ultimately give up, but the debug log (from /home/blogs/logs/nginx/error.log as /home/blogs/logs/nginx/site/error.log is just blank) yields only one line:

2014/01/03 19:20:35 [debug] 8536#0: epoll add event: fd:11 op:1 ev:00000001

I'm guessing the weak link is nGinx.

Trying to hit the site from a restricted domain, produces the 403 as expected, and the debug log to actually work.

My question is less how to make my setup work, but why the setup isn't debugging. A simple fuser tells me Hip-hop is running on 9000. I feel like I could make some headway if I knew what was wrong.


I'm super self-conscious of my questions on Stackoverflow; I've seen people been ripped apart and it's frankly quiet scary. I realize there's another similar, very recent, question: HHVM with Nginx fastcgi not working properly but given our configurations are not quiet the same, and my question is more about the debug log (albeit a very short one) I thought my situation warranted another question.


NOTE:

Tag by rights should be hhvm-fastcgi, but I don't have the rep to create it as a tag.

Upvotes: 0

Views: 470

Answers (1)

Dylan Madisetti
Dylan Madisetti

Reputation: 775

Wow. Just Wow.

Turns out after struggling with this for far too long, turns out it was my firewall was blocking port 80. Why I was able to invoke a 403? I occasionally run a proxy through the server, so the other domain I tested with was seen as an internal request.

I'm guessing this proxy mix up is what led to anything being in the error logs at all.

As deeply embarrassing as this mix up has been- I'm going to leave this question up, because I've taken something away from this experience.

  • First of all, don't point fingers:

I immediately assumed because nothing else could have been invoked it was nginx's fault. The strange debug log egged on my doubts.

  • Secondly, look higher:

No point looking at the middle of the stack. I should have looked for requests, and made sure that that calls were even being made.

  • Thirdly, keep track of what your doing:

My obvious confusion stemmed from the fact I had some weird proxy mojo going on. Had I taken the time to remember everything out of the ordinary I was doing with my server, I might have thought to check my firewall settings earlier.


There go my chances at a tumbleweed badge

Upvotes: 2

Related Questions