mrsuh/nginx-session-handler

Nginx session handler

Installs: 1 629

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

Type:symfony-bundle

2.1.0 2019-08-29 14:59 UTC

This package is auto-updated.

Last update: 2021-06-29 01:02:21 UTC


README

Latest Stable Version Total Downloads License

This bundle integrates predis and snc/redis-bundle into your Symfony 3/4 application So, you need to configure the bundles too.

Installation

Add the nginx-session-handler package to your require section in the composer.json file.

composer require mrsuh/nginx-session-handler:2.*

Add the NginxSessionHandlerBundle to your application's kernel (Symfony 3):

<?php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Mrsuh\NginxSessionHandlerBundle\MrsuhNginxSessionHandlerBundle(),
        // ...
    );
    ...
}

Configure the session in your config.yml:

framework:
    session:
        handler_id:  mrsuh.session_handler

mrsuh_nginx_session_handler:
    session_lifetime: 3600
    session_prefix: phpsession

Add session.lua script to your nginx.conf

location /security {
    content_by_lua_file session.lua;
}

Now your php session locate in redis. Your location /security allow for authenticated users with role ROLE_ADMIN only.