mrsuh/nginx-session-handler

Nginx session handler

2.0.3 2018-05-18 15:15 UTC

README

Latest Stable Version Total Downloads License

This bundle integrates predis and snc/redis-bundle into your Symfony3 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:

<?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.