1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.1 XF on dotcloud (NGINX+fastcgi)

Discussion in 'Troubleshooting and Problems' started by adin, Nov 24, 2011.

  1. adin

    adin Active Member

    I'm testing an install (with an eye to migration) on dotcloud. That means that a stock XF is running under NGINX in dotcloud's config. (no nginx config files ATM, using the stock config). I've already tried modding the XF nginx.conf at nginx.

    So, the issue-xF is constantly "logging me out" while I'm trying to work with it, usually while trying to work with things like rebuilding the caches after installing an addon, or while importing data. (and then if I don't login, I then get a 'not allowed' or 'not found' (which I assume means that the fastcgi interface didn't report back, maybe XF crashed?)

    My instinct is telling me that this is is actually something triggering a timeout, or possibly something going wonky with the fastcgi interface running the PHP. Their nginx<--->fastcgi interface does has a nonmodifiable 60 second limit, so might there be something to tweak with that?

    Also as an aside, their config comes with apc by default, which I have disabled with a mini php.ini in the home directory.

    All this is up at forums-phoenixrising.dotcloud.com.....if anyone wants to dig further, I can give access.
     
  2. Mike

    Mike XenForo Developer Staff Member

    The server is likely behind a proxy, causing your IP to change on every page. Go to http://forums-phoenixrising.dotcloud.com/admin.php?tools/phpinfo Look for your actual IP address in a _SERVER variable at the bottom.

    Add to config.php:
    Code:
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_HEADER_NAME_HERE'];
    Changing the "header name here" based on what you found.
     
  3. adin

    adin Active Member

    hmm, adding that to the (stock) config.php at the end gives me a "An unexpected error occurred. Please try again later."
     
  4. Mike

    Mike XenForo Developer Staff Member

    What did you actually add?
     
  5. adin

    adin Active Member

    Code:
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_HEADER_NAME_HERE'];
     
  6. Dan

    Dan Well-Known Member

    Did you change header name here?
     
  7. adin

    adin Active Member

    oh, d'oh! that'll teach me to try to multi-task (while doing thanksgiving dinner nonetheless!).

    do I need to put the http_x_real_ip, remote_addr, or server_addr into the header? (I'm still trying to wrap my brain around how dotcloud is provisioning from ec2)

    [update]none of the ip's seem to work, also tried specifying port #'s, sever_name, same error-misconfig

    Code:
    _SERVER["HOME"]	/home/dotcloud
    _SERVER["FCGI_ROLE"]	RESPONDER
    _SERVER["QUERY_STRING"]	tools/phpinfo
    _SERVER["REQUEST_METHOD"]	GET
    _SERVER["CONTENT_TYPE"]	no value
    _SERVER["CONTENT_LENGTH"]	no value
    _SERVER["SCRIPT_FILENAME"]	/home/dotcloud/current/admin.php
    _SERVER["SCRIPT_NAME"]	/admin.php
    _SERVER["REQUEST_URI"]	/admin.php?tools/phpinfo
    _SERVER["DOCUMENT_URI"]	/admin.php
    _SERVER["DOCUMENT_ROOT"]	/home/dotcloud/current
    _SERVER["SERVER_PROTOCOL"]	HTTP/1.0
    _SERVER["GATEWAY_INTERFACE"]	CGI/1.1
    _SERVER["SERVER_SOFTWARE"]	nginx/0.8.53
    _SERVER["REMOTE_ADDR"]	10.44.110.239
    _SERVER["REMOTE_PORT"]	34131
    _SERVER["SERVER_ADDR"]	192.168.1.41
    _SERVER["SERVER_PORT"]	80
    _SERVER["SERVER_NAME"]	forums-default-www-0
    _SERVER["REDIRECT_STATUS"]	200
    _SERVER["HTTP_HOST"]	forums-phoenixrising.dotcloud.com
    _SERVER["HTTP_X_REAL_IP"]	::ffff:96.8.251.184
    _SERVER["HTTP_X_FORWARDED_FOR"]	::ffff:96.8.251.184
    _SERVER["HTTP_X_FORWARDED_PROTO"]	http
    _SERVER["HTTP_X_FORWARDED_PROTOCOL"]	http
    _SERVER["HTTP_X_FORWARDED_PORT"]	80
    _SERVER["HTTP_CONNECTION"]	close
    _SERVER["HTTP_USER_AGENT"]	Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3
    _SERVER["HTTP_ACCEPT"]	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    _SERVER["HTTP_REFERER"]	http://forums-phoenixrising.dotcloud.com/admin.php?tools/phpinfo
    _SERVER["HTTP_ACCEPT_LANGUAGE"]	en-us
    _SERVER["HTTP_ACCEPT_ENCODING"]	gzip, deflate
    _SERVER["HTTP_IF_MODIFIED_SINCE"]	Thu, 24 Nov 2011 20:28:48 GMT
    _SERVER["HTTP_COOKIE"]	xf_session=052efe10602c3d35febc250acce14e8f; xf_session_admin=ecd0699cf1be35411916fdb97de2cb52; __utma=114948242.1300681802.1321573812.1322123309.1322165782.17; __utmb=114948242.2.10.1322165782; __utmc=114948242; __utmz=114948242.1321573812.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=dotcloud; mp_super_properties=%7B%22all%22%3A%20%7B%22mp_keyword%22%3A%20%22dotcloud%22%2C%22%24search_engine%22%3A%20%22google%22%2C%22%24initial_referrer%22%3A%20%22http%3A//www.google.com/url%3Fsa%3Dt%26rct%3Dj%26q%3Ddotcloud%26source%3Dweb%26cd%3D1%26ved%3D0CDgQFjAA%26url%3Dhttp%253A%252F%252Fdotcloud.com%252F%26ei%3Dpp3FToPlMsbJsQLE8MGxCw%26usg%3DAFQjCNHWj1xhqyy7kldPrd-mtd2kLtJ41Q%26sig2%3DbQZega-2nM3UUbaNrVf7Gg%22%2C%22%24initial_referring_domain%22%3A%20%22www.google.com%22%7D%2C%22events%22%3A%20%7B%7D%2C%22funnels%22%3A%20%7B%7D%7D; __qca=P0-1987335960-1321653954197
    
     
  8. Mike

    Mike XenForo Developer Staff Member

    Oh, they're forwarding with IPv6 addresses too. Use this:
    Code:
    $_SERVER['REMOTE_ADDR'] = str_replace('::ffff:', '', $_SERVER['HTTP_X_REAL_IP']);
     
  9. adin

    adin Active Member

    no dice, still an error. exact copy (except for the last two octets of the address) of the end of the config.php:

    Code:
    $_SERVER['REMOTE_ADDR'] = str_replace('::ffff:', '', $_SERVER['96.8.xxx.xxx']);
    uggh.
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Use exactly what Mike posted. Don't change anything:

    Code:
    $_SERVER['REMOTE_ADDR'] = str_replace('::ffff:', '', $_SERVER['HTTP_X_REAL_IP']);
    
     
  11. adin

    adin Active Member

    oi, ever have days where the obvious completely escapes you?

    so, forward progress, half solved!

    ....now just getting 405 errors , but not as often.

    (I've seen talk about accidental http POSTs against a static file?)
     
    Dan likes this.
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  13. adin

    adin Active Member

    Code:
    ==> /var/log/nginx/forums-default-www-0.error.log <==
    2011/11/25 04:25:12 [error] 72#0: *566 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 10.85
    .161.225, server: forums-default-www-0, request: "POST /admin.php?import/import HTTP/1.0", upstream: "fastcgi://unix:/var/dotcloud/php5-fpm.sock
    :", host: "forums-phoenixrising.dotcloud.com", referrer: "http://forums-phoenixrising.dotcloud.com/admin.php?import/import"
    2011/11/25 04:25:12 [error] 72#0: *566 open() "/home/dotcloud/current/static/504.html" failed (2: No such file or directory) while sending to cl
    ient, client: 10.85.161.225, server: forums-default-www-0, request: "POST /admin.php?import/import HTTP/1.0", upstream: "fastcgi://unix:/var/dot
    cloud/php5-fpm.sock:", host: "forums-phoenixrising.dotcloud.com", referrer: "http://forums-phoenixrising.dotcloud.com/admin.php?import/import"
    2011/11/25 05:12:32 [error] 72#0: *659 open() "/home/dotcloud/current/favicon.ico" failed (2: No such file or directory), client: 10.44.110.239,
     server: forums-default-www-0, request: "GET /favicon.ico HTTP/1.0", host: "forums-phoenixrising.dotcloud.com"
    2011/11/25 05:12:32 [error] 72#0: *659 open() "/home/dotcloud/current/static/404.html" failed (2: No such file or directory), client: 10.44.110.
    239, server: forums-default-www-0, request: "GET /favicon.ico HTTP/1.0", host: "forums-phoenixrising.dotcloud.com"
    2011/11/25 05:12:32 [error] 72#0: *660 open() "/home/dotcloud/current/favicon.ico" failed (2: No such file or directory), client: 10.44.110.239,
     server: forums-default-www-0, request: "GET /favicon.ico HTTP/1.0", host: "forums-phoenixrising.dotcloud.com"
    2011/11/25 05:12:32 [error] 72#0: *660 open() "/home/dotcloud/current/static/404.html" failed (2: No such file or directory), client: 10.44.110.
    239, server: forums-default-www-0, request: "GET /favicon.ico HTTP/1.0", host: "forums-phoenixrising.dotcloud.com"
    2011/11/25 05:21:40 [error] 72#0: *722 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 10.85
    .161.225, server: forums-default-www-0, request: "POST /admin.php?import/import HTTP/1.0", upstream: "fastcgi://unix:/var/dotcloud/php5-fpm.sock
    :", host: "forums-phoenixrising.dotcloud.com", referrer: "http://forums-phoenixrising.dotcloud.com/admin.php?import/import"
    2011/11/25 05:21:40 [error] 72#0: *722 open() "/home/dotcloud/current/static/504.html" failed (2: No such file or directory) while sending to cl
    ient, client: 10.85.161.225, server: forums-default-www-0, request: "POST /admin.php?import/import HTTP/1.0", upstream: "fastcgi://unix:/var/dot
    cloud/php5-fpm.sock:", host: "forums-phoenixrising.dotcloud.com", referrer: "http://forums-phoenixrising.dotcloud.com/admin.php?import/import"
    2011/11/25 06:38:01 [error] 72#0: *748 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 10.85
    .161.225, server: forums-default-www-0, request: "POST /admin.php?import/import HTTP/1.0", upstream: "fastcgi://unix:/var/dotcloud/php5-fpm.sock
    :", host: "forums-phoenixrising.dotcloud.com", referrer: "http://forums-phoenixrising.dotcloud.com/admin.php?import/import"
    2011/11/25 06:38:01 [error] 72#0: *748 open() "/home/dotcloud/current/static/504.html" failed (2: No such file or directory) while sending to cl
    ient, client: 10.85.161.225, server: forums-default-www-0, request: "POST /admin.php?import/import HTTP/1.0", upstream: "fastcgi://unix:/var/dot
    cloud/php5-fpm.sock:", host: "forums-phoenixrising.dotcloud.com", referrer: "http://forums-phoenixrising.dotcloud.com/admin.php?import/import"
    
    ==> /var/log/nginx/forums-default-www-0.error.log <==
    2011/11/25 07:04:07 [error] 72#0: *933 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 10.85
    .161.225, server: forums-default-www-0, request: "POST /admin.php?import/import HTTP/1.0", upstream: "fastcgi://unix:/var/dotcloud/php5-fpm.sock
    :", host: "forums-phoenixrising.dotcloud.com", referrer: "http://forums-phoenixrising.dotcloud.com/admin.php?import/import"
    2011/11/25 07:04:07 [error] 72#0: *933 open() "/home/dotcloud/current/static/504.html" failed (2: No such file or directory) while sending to cl
    ient, client: 10.85.161.225, server: forums-default-www-0, request: "POST /admin.php?import/import HTTP/1.0", upstream: "fastcgi://unix:/var/dot
    cloud/php5-fpm.sock:", host: "forums-phoenixrising.dotcloud.com", referrer: "http://forums-phoenixrising.dotcloud.com/admin.php?import/import"
     
  14. adin

    adin Active Member

    installed a fresh copy on my vps, imported current database from vbulletin, reinserted the explicit reference to the real server IP, & did a fresh push to dotcloud .
    (Currently in action at www.cloud.phoenixrising.me ), got the exact same issue, this time when deleting a node.

    From the nginx error logs:

    Code:
    2011/11/30 04:24:55 [error] 72#0: *25 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 10.85.161.225, server: forums-default-www-0, request: "GET /css.php?css=account,events,moderator_bar,news_feed&style=1&dir=LTR&d=1322364999 HTTP/1.0", upstream: "fastcgi://unix:/var/dotcloud/php5-fpm.sock:", host: "forums-phoenixrising.dotcloud.com", referrer: "http://forums-phoenixrising.dotcloud.com/index.php?account/news-feed"
    2011/11/30 04:24:55 [error] 72#0: *25 open() "/home/dotcloud/current/static/504.html" failed (2: No such file or directory) while sending to client, client: 10.85.161.225, server: forums-default-www-0, request: "GET /css.php?css=account,events,moderator_bar,news_feed&style=1&dir=LTR&d=1322364999 HTTP/1.0", upstream: "fastcgi://unix:/var/dotcloud/php5-fpm.sock:", host: "forums-phoenixrising.dotcloud.com", referrer: "http://forums-phoenixrising.dotcloud.com/index.php?account/news-feed"
     
  15. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Are we still talking about the 405 error? I don't see any 405 errors in those logs.

    At the very least, a 405 error is a server restriction. The server is not allowing a certain request method. I have also seen proxies change the request method which may instigate an error like this.
     
  16. adin

    adin Active Member

    I know, that's the really weird thing. Usually they show up intermittently when running a task that goes beyond user access stuff, like when doing the import, once while doing the install, while deleting a node/category. And sometimes I just get kicked out (the 'logout') and sometimes my browser (tested in multiple browsers, multiple platforms) just shows (I **SWEAR**) a 405 error--it's like there's an error that's occurring in the fastcgi module and its getting sent as a 405 by nginx.
     

Share This Page