nGinx中的调试会产生1行和无限的沮丧 - 如何调试调试器 [英] Debugging in nGinx yields 1 line and infinite frustration- How to Debug the Debugger

查看:157
本文介绍了nGinx中的调试会产生1行和无限的沮丧 - 如何调试调试器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实验项目的日子!我决定尝试用Facebook的新 hhvm-fastcgi 设置我的博客, wordpress。遵循说明,并使用以下nGnix配置:

  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;
}
}

服务器{
听*: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关闭;
set $ myuri $ request_uri;

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

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

#尝试MemCached首先
位置/ {
设置$ memcached_key$ uri?$ args;
memcached_pa​​ss 127.0.0.1:11211;
error_page 404 405 502 504 = @fallback;
}

位置〜\.php $ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME / home / blogs / wordpress $ fastcgi_script_name;
包含fastcgi_params;
}

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

位置〜* \。(js | css | png | jpg | jpeg | gif | ico)$ {
expires max;
log_not_found off;
}
}

如果工作起来太简单了点击网站只会导致我的浏览器挂起并最终放弃,但调试日志(从 /home/blogs/logs/nginx/error.log /home/blogs/logs/nginx/site/error.log 只是空白)只能生成一行:

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

我猜这个弱链接是nGinx。



试图从受限制的域中访问该网站,产生403如预期,调试日志实际工作。



我的问题是如何使我的设置工作,但 为什么 安装程序没有调试。一个简单的 fuser 告诉我在9000上运行Hip-Hop 。如果我知道发生了什么,我觉得我可以取得进展。 p>




我对Stackoverflow的问题超级自我意识;我看到人们被剥夺了,坦白地说是可怕的。我意识到还有一个类似的,最近的问题:使用Nginx fastcgi的HHVM无法正常工作但是由于我们的配置并不安静,我的问题更多的是调试日志(尽管很短),我认为我的情况有另一个问题。






注意:



按权限标记应为 hhvm-fastcgi ,但是我没有将代码创建为标签。

解决方案

哇。只是哇。



在这样做很久以后,结果是太久了,原来是我的防火墙阻塞了端口80.为什么我是能够调用403?我偶尔通过服务器运行代理,所以我测试的其他域被视为内部请求。



我猜这个代理混合是什么导致任何事情都在错误日志中。



由于这个混合一直很尴尬 - 我要离开这个问题,因为我已经采取了一些事情




  • 首先,不要指点:



我立即假定,因为没有其他可以被调用的是nginx的错误。奇怪的调试日志就是我的怀疑。




  • 其次,看起来更高:



没有点看堆栈的中间。我应该寻找请求,并确保该通话甚至被发送。




  • 第三,跟踪你在做什么: / li>


我的明显困惑来自于我有一些奇怪的代理mojo的事实。如果我花时间记住我正在使用我的服务器的一切,我可能以前想过检查我的防火墙设置。






我有机会在滚卷徽章


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.

解决方案

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

这篇关于nGinx中的调试会产生1行和无限的沮丧 - 如何调试调试器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆