Welcome! Log In Create A New Profile

Advanced

Keep Session between sub domains

Posted by JohnD 
Keep Session between sub domains
December 11, 2011 04:25PM
Hi There,

I am using Nginx latest version.
Using nginx Frontend Server as Load Balancer,
and 2 backend php servers.

Everything works fine except the sessions.

I have subdomains added as allias:

alias.domain.com
alias2.domain.com
alias3.domain.com
all target the same index.php
to check if everything work fine i add inside of my index.php the following code:

<?php
session_destroy();
session_start();

if(isset($_SESSION['views']))
$_SESSION['views']=$_SESSION['views']+1;
else
$_SESSION['views']=1;
echo "Views=". $_SESSION['views'];
?>

i get +1 correctly but after change from alias1.domain.com to alias2.domain.com it start counting from the 0.


How i can fix that with nginx?

I tried with "Sticky" module and "Ip_hash"
i get the same result.


Any help would be appriciate.

Thanks a lot and sorry for my bad english i will try me best if you need further explain.


Regards,
John
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 118
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready