Hi,

I have Pressflow 6 and Nginx. Asynchronous Mode is always False.

Debug info:
http://127.0.0.1/site/sites/default/files/advagg_css/css_missing56085193...

stdClass Object (
    [code] => -111
    [error] => Connection refused
    [timer] => Array (
            [count] => 1
            [time] => 0.37
        )
)

File css_5608519351317939125_0.css (or any other showed here) is never exist in advagg_css folder.

Any ideas how to fix that?

CommentFileSizeAuthor
#7 nginx.zip1.39 KBsuperfedya
#7 mysite.zip817 bytessuperfedya
#5 nginx.zip13.18 KBPeter Bowey
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

superfedya’s picture

I put IP Address to send all asynchronous requests to: -1 and now is a new error:

stdClass Object (
    [request] => GET /site/sites/default/files/advagg_css/css_missing15432283731317943050_0.css HTTP/1.0
Host: www.mysite.com
User-Agent: Drupal (+http://drupal.org/)
Connection: close

    [data] => <html>
<head><title>500 Internal Server Error</title></head>
<body bgcolor="white">
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx/1.0.1</center>
</body>
</html>
    [protocol] => HTTP/1.1
    [status_message] => Internal Server Error
    [headers] => Array (
            [Server] => nginx/1.0.1
            [Date] => Thu, 06 Oct 2011 23:17:30 GMT
            [Content-Type] => text/html
            [Content-Length] => 192
            [Connection] => close
        )
    [error] => Internal Server Error
    [code] => 500
    [timer] => Array (
            [count] => 1
            [time] => 0.98
        )
)

In my Nginx I pasted:

    ###
    ### advagg_css and advagg_js support
    ###
    location ~* advagg_(?:css|js)/ {
        access_log off;
        expires 365d;
        add_header Pragma "";
        add_header Cache-Control "public";
        try_files $uri @drupal;
    }
Peter Bowey’s picture

Please see omega8cc's setup for Drupal + Nginx + Advagg!

I have placed a direct link to the file that will help you
with the best setup:

https://github.com/omega8cc/nginx-for-drupal/blob/master/aegir/conf/ngin...

superfedya’s picture

My logs:
2011/10/07 01:28:37 [error] 30140#0: *368 could not find named location "@drupal", client: 47.4.91.18, server: mysite.com, request: "GET /site/sites/default/files/advagg_css/css_missing4083484831317943717_0.css HTTP/1.0", host: "www.mysite.com"

peter bowey
Thanks!
But always same error: could not find named location "@drupal"
If I erase this line I got 404 error: try_files $uri @drupal;

Any suggestion?
Thanks!

Peter Bowey’s picture

You could be using a older Nginx that does not support "named locations"
- Else, you have a error in the nginx.conf.

I am happily using the same Pressflow + Advagg as you.
Yes, I have [once] been through the same issues as you have reported :-)

The nginx 500 error simply means 'misconfiguration' [something illegal within nginx.conf]

Peter Bowey’s picture

FileSize
13.18 KB

Does it help if I attach my working nginx.conf file for you to study?

Peter Bowey’s picture

        # advagg_css and advagg_js support (Drupal Advanced CSS/JS Aggregation module)
        location ~* files/advagg_(?:css|js)/ {
            access_log          off;
            tcp_nodelay         off;                    #
            expires             max;
            limit_conn gulag    50;                     # Allow for fast advagg async
            rewrite    ^/files/advagg_(.*)/(.*)$ /sites/$host/files/advagg_$1/$2 last;
            # Unset unnecessary headers
            if_modified_since   off;
            add_header          Pragma "";              # Disable Pragma
            add_header          Last-Modified "";       # Disable Last-Modified (use ETag instead)
            add_header          Cache-Control "public, must-revalidate, proxy-revalidate";
            add_header          X-Header "AdvAgg Generator 1.0";
            try_files $uri @drupal;
        }
        # make css files compatible with boost caching - nginx 0.7.27 or newer required with try_files support
        location ~* \.css$ {
            access_log          off;
            tcp_nodelay         off;
            expires             max;                    # if using aggregator
            # Unset unnecessary headers
            if_modified_since   off;
            add_header          Pragma "";              # Disable Pragma
            add_header          Last-Modified "";       # Disable Last-Modified (use ETag instead)
            add_header          Cache-Control "public, must-revalidate, proxy-revalidate";
            add_header X-Header "Boost Citrus 2.1";
            try_files $uri =404;
        }
        # make js files compatible with boost caching - nginx 0.7.27 or newer required with try_files support
        location ~* \.(?:js|htc)$ {
            access_log          off;
            tcp_nodelay         off;
            expires             max;                    # if using aggregator
            # Unset unnecessary headers
            if_modified_since   off;
            add_header          Pragma "";              # Disable Pragma
            add_header          Last-Modified "";       # Disable Last-Modified (use ETag instead)
            add_header          Cache-Control "public, must-revalidate, proxy-revalidate";
            add_header X-Header "Boost Citrus 2.2";
            try_files $uri =404;
        }

        # Send all not cached requests to drupal with clean URLs support [D6].
        location @drupal {
            rewrite ^/(.*)$  /index.php?q=$1 last;
        }
superfedya’s picture

FileSize
817 bytes
1.39 KB

My nginx support it. I added the line:

# only needed for Drupal 6 (or if you absolutely need a named location)
location @drupal {
  rewrite ^ /index.php?q=$uri last; # for drupal 6
}

When I add it it shows:

stdClass Object (
    [error] => missing schema
    [code] => 301
    [redirect_code] => -1002
    [redirect_url] => /site
    [timer] => Array (
            [count] => 1
            [time] => 1.5
        )
)

Maybe because my drupal in /site folder. So I add:

# only needed for Drupal 6 (or if you absolutely need a named location)
location @drupal {
  rewrite ^ site/index.php?q=$uri last; # for drupal 6
}

No result.
I attach my config, maybe somebody can tell me what the problem...

Thanks

superfedya’s picture

>Does it help if I attach my working nginx.conf file for you to study?

It's too complicated O__O
Hmmm, this line:
location @drupal {
rewrite ^/(.*)$ /index.php?q=$1 last;
}

How can I modify it too add a sub-folder? If I do something like: rewrite ^site/(.*)$ /index.php?q=$1 last; I got nginx error:

2011/10/07 03:21:56 [error] 32433#0: *11 open() "/usr/local/nginx//html/site/sites/default/files/advagg_css/css_missing6730073131317950516_0.css" failed (2: No such file or directory), client: 46.4.97.38, server: mysite.com, request: "GET /site/sites/default/files/advagg_css/css_missing6730073131317950516_0.css HTTP/1.0", host: "www.madfanboy.com"

This path is completely wrong:
/usr/local/nginx//html/site/sites/default/files/advagg_css/css_missing6730073131317950516_0.css
Must be:
/var/www/mysite.com/site/sites/default/files/advagg_css/css_missing6730073131317950516_0.css

How can I fix it?

Peter Bowey’s picture

Peter Bowey’s picture

Switch to the latest advagg devel version:

http://drupal.org/node/1066530

superfedya’s picture

I disable CDN and don't think that this module create this problem. 100% it's my bad nginx config X_X

Thanks

superfedya’s picture

>Switch to the latest advagg devel version:

Done. Same error.

Peter Bowey’s picture

I had a quick look at your two config files: [messy code *smile*]
"They both need a clean rewrite"

Why not use one of the above [working examples] to get a clean working nginx config?

Also the named location should be moved to after the caller [ref]!

    ###
    ### advagg_css and advagg_js support
    ###
    location ~* files/advagg_(?:css|js)/ {
	root /var/www/madfanboy.com;
        access_log off;
        expires 365d;
        add_header Pragma "";
        add_header Cache-Control "public";
        try_files $uri @drupal;
    }

# only needed for Drupal 6 (or if you absolutely need a named location)
location @drupal {
rewrite ^ site/index.php?q=$uri last; # for drupal 6
}

If those two files are your total setup for nginx; there is a lot of 'normal' nginx handling missing...
A sound structure is required, I think.

Peter Bowey’s picture

Refer #8:

# only needed for Drupal 6 (or if you absolutely need a named location)
location @drupal {
    rewrite ^ site/index.php?q=$uri last; # for drupal 6
}

The code [above] is not correct for any folder(s), as we *must* use /index.php in the D6 web root.

This code *is* correct, regardless of what folder(s):

location @drupal {
  rewrite ^/(.*)$  /index.php?q=$1 last;
}

The folder locations are handled by index.php (and the 'args' supplied) - assuming it is non-static (php) GET

You may be referring to multi-site domains + folders?

The

"This path is completely wrong:
/usr/local/nginx//html/site/sites/default/files/advagg_css/css_missing6730073131317950516_0.css

results because of your nginx setup (as I read it in the two attached files). You are defaulting to the nginx install / config location - rather than the www location.

superfedya’s picture

Ok thanks, ill try to rewrite my config this weekends :)

>You may be referring to multi-site domains + folders?

Only folders.

superfedya’s picture

One more question - above Nginx config will work if I don't have php FastCGI via Nginx?

Thanks

Peter Bowey’s picture

Refer: # 16

One more question - above Nginx config will work if I don't have php FastCGI via Nginx?

You will need pickup and deal with the references to 'fastcgi' compared to your current 'PHP proxy bypass' to apache!

The difference is not too much! Basically, your current method is employing the older + traditional nginx proxy bypass to let apache handle the PHP 'grunt work'. With PHP5.3.x, the nginx fastCGI PHP is much preferred [over apache].

proxy_pass http://127.0.0.1:8080;

Think seriously [soon - when you are code ready] to moving everything [via http] over to nginx, and dropping apache.
There are great benefits.
I have been on the same progressive path you are treading this day. It is worth your time to flow with it - step -by- step.
You are not alone, many walk with you :-)

superfedya’s picture

Thanks!

But if ill transfer my apache php to nginx php-fpm it will scrap all my php settings - memcache, apc? Nginx doesn’t work well with .httacces? All Drupal modules work well with this config?

There is some instruction to transfer the PHP from Apache to Nginx?
Or I can just :
apt-get install php5-fpm php5-cgi
And configure my nginx after? Or I need to setup up something else?
There is any other pittfalls?

Peter Bowey’s picture

But if ill transfer my apache php to nginx php-fpm it will scrap all my php settings - memcache, apc? Nginx doesn’t work well with .httacces? All Drupal modules work well with this config?

No, all the above PHP modules are OK. Nginx does not need or use .htaccess. You implement your own nginx .htaccess methods, and they are documented [but you will need read a lot].

I see that you must be using a Debian / Fedora / Ubuntu Linux: so just use "apt-get install php5-fpm"

See: http://www.howtoforge.com/installing-php-5.3-nginx-and-php-fpm-on-ubuntu...
and: https://github.com/perusio/drupal-with-nginx [a very skilled nginx supporter]

another older pointer: http://wiki.nginx.org/Drupal

mikeytown2’s picture

@superfedya
Fixing this issue here will hopefully fix your other issue here #1138098-31: Pre generation kills the machine. Both modules use the same idea; issue a secondary request to do background processing.

superfedya’s picture

mikeytown2
Thank you! I'll try.

mikeytown2’s picture

Status: Active » Postponed (maintainer needs more info)

Postponing this issue as I haven't heard anything. If everything is working, go ahead and close this issue.

vinoth.3v’s picture

Version: 6.x-1.5 » 6.x-1.x-dev
Status: Postponed (maintainer needs more info) » Active

same here.

My nginx is with in reverse proxy. So localhost connection always will be refused.

reverse_proxy enabled in Drupal.

any help?

mikeytown2’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

Closing out older issues.