【问题标题】:jsessionid setting in nginx server for session in yii?nginx服务器中的jsessionid设置用于yii中的会话?
【发布时间】:2014-08-12 18:00:17
【问题描述】:

这是我在default.conf中的设置:

#
# The default server
#
#upstream tomcat_server {
# Tomcat is listening on default 8080 port
#       server 127.0.0.1:8080 fail_timeout=0;
#  }

server {
     listen       80;
     server_name xx.xx.xxx.xxx;
     root /var/www/html;   
     charset utf-8;
     set $yii_bootstrap "index.php";

# autoindex off;
    # rewrite ^/$ /web/ permanent;
 location / {
    #root /var/www/html;
        index  index.html $yii_bootstrap;
       # proxy_pass http://127.0.0.1:9000/;

#rewrite .* /index.php last;  
try_files $uri $uri/ /web/index.php?$query_string;
}

    error_page  404              /404.html;
    location = /404.html {
    root /var/www/html/web;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    root   /usr/share/nginx/html;
    }

 location ~ \.php {
#proxy_pass http://127.0.0.1:9000/web/;
     fastcgi_split_path_info ^(.+\.php)(.*)$;
     fastcgi_pass   127.0.0.1:9000;
     fastcgi_index  index.php;
     fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
     include        fastcgi_params;
    }
## Images and static content is treated different
    location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
      access_log        off;
      expires           max;
     # root /var/www/html;
    }


} 

这是我的控制台:

我的会话不工作:

Yii::app()->user->setState('name',$name);
 Yii::app()->user->getState('name');

为此我需要 jsessionid。

我该怎么办?

【问题讨论】:

    标签: php session yii nginx jsessionid


    【解决方案1】:

    如果您想重命名 PHP 的默认会话名称,请在您的 nginx 配置文件中的 fastcgi_param SCRIPT_FILENAME... 之后添加以下行:

    fastcgi_param PHP_VALUE "session.name=JSESSIONID"
    

    【讨论】:

    • 我不是在问这个。我在询问 nginx 中的 JSESSIONID 设置
    【解决方案2】:

    我必须给#777这个文件夹的权限:

     /var/lib/php/session
    

    权限:

    chmod -R 0777 /var/lib/php/session
    

    用于写入会话数据。

    【讨论】:

      猜你喜欢
      • 2013-09-08
      • 1970-01-01
      • 2012-12-21
      • 2016-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-26
      • 2018-05-02
      相关资源
      最近更新 更多