Nginx as load balancer + apache as a web server issue

Hello guys,

Im having some weird issue. I currently have my website setup as
follows,

  • 1 nginx server configured as a load balancer
  • 2 apache servers configured to server the http traffic from the nginx
    server

I have a similar ecommerce site where people can buy products, the issue
is that when I try to remove a product from the cart, the product doesnt
get removed.

Few troubleshooting achievements that inclined me to say that its nginx:
I changed my local DNS so I mapped my website to use each of my apache
web servers directly and the problem doesnt show up! item gets removed
from the cart properly.

This is a HTTP website, no secure connection are enabled yet. Could this
be because of a PHP session issues? I have “ip_hash;” configured on my
nginx.conf config file. I can paste my nginx.conf if needed.

Any advice will be appreciated!

Thank you.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,118156,118156#msg-118156

sounds to me like a session issue. why not just use memcached as session
backend?

http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/

Hello,

Thanks for your quick response, Im going to try that now.
The thing is I have two webservers, on which one should I store this? If
Im not wrong if the server that has the memcache running goes down my
website will wont work, is that correct?

Thanks again.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,118156,118402#msg-118402

Thanks for your quick response, Im going to try that now.
The thing is I have two webservers, on which one should I store this? If
Im not wrong if the server that has the memcache running goes down my
website will wont work, is that correct?

You can run a memcached instance on each webserver and provide both to
the
php client/extension. It will automatically distribute / loadbalance and
in
case one server goes down continue to work with other (typically all
memcache extensions disable the failed instance for given time period
(15
secs) and retry later so there is bassically also no connect delays
because
of unresponding servers).

Depending on the needs there is possibility to replicate the session
data
(sessions are written to both memcache servers) by setting the PHP ini
variable memcache.session_redundancy for example to 2.

rr

Hello again,

Another troubleshooting achievement, Its working on firefox with or
without doing the memcache config just fine. It seems the problem is on
ie8 only. Although when I use ie8 with the local DNS mapping explaine
above Im not getting such a weird problem.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,118156,118490#msg-118490

Hey guys,

I have just found and fixed the issue, it was related to the following
settings, commenting them solved the ie8 issue,

client_body_timeout 60;

client_header_timeout 60;

expires 24h;

keepalive_timeout 60 60;

send_timeout 60;

Any advice why this would happen?

Thanks!

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,118156,118569#msg-118569

On Tue, Aug 10, 2010 at 8:17 PM, josesan311 [email protected]
wrote:

Any advice why this would happen?

The “expires 24h” is probably telling nginx to add a cache-control
header to everything in that location. So the browser was caching the
old page that didn’t have the item removed from the cart, and showing
that. (I am assuming your “expires” was set at a high level in nginx
configuration, maybe at the server level?)

Typically, in most applications, dynamic pages should expire
immediately, and static items (images, CSS, JS, etc.) should have
longer expiration times sent to the browser. (There are exceptions, of
course… think of an RSS feed. You might want it to be cached for 15
minutes, even though it is a dymic page.)

You can make separate locations in nginx to fix this (one for statics,
the other for dynamics). Use a regex-based location if all the dynamic
stuff isn’t under one path.


RPM

Hey guys,

I have just put one of the webserver nodes down in nginx.conf and
installed memcached+PHP memcache on the only running apache webserver,
although the problem persists.

Any advice?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,118156,118478#msg-118478

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs