Hi Forum: 


I tell you that I have a server with Centos 7.1 nginx 1.6.3 and mysql 
5.6.28. Web2py versión is: 2.13.4-stable+timestamp.2015.12.26.04.59.39
My app saves sessions on bd.  I put the following stament in db.py

session.connect(request, response, db)

Maybe it is preferable to store sessions in files.  I don´t know.

 


My configuration file is : (nginx.conf).

user nginx;

worker_processes auto;

error_log /var/log/nginx/error.log;

pid /run/nginx.pid;


events {

   worker_connections 2046;

}


http {

   log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                     '$status $body_bytes_sent "$http_referer" '

                     '"$http_user_agent" "$http_x_forwarded_for"';


    access_log  /var/log/nginx/access.log  main;


    sendfile            on;

   tcp_nopush          on;

   tcp_nodelay         on;

   keepalive_timeout   95;

   types_hash_max_size 2048;


        #client_body_buffer_size 10K;

  #client_header_buffer_size 1k;

 #client_max_body_size 8m;

      #large_client_header_buffers 2 1k;


    include             /etc/nginx/mime.types;

   default_type        application/octet-stream;


    # Load modular configuration files from the /etc/nginx/conf.d directory.

   # See http://nginx.org/en/docs/ngx_core_module.html#include

   # for more information.

   # include /etc/nginx/conf.d/*.conf;


    server {

       listen       80 default_server;

       listen       [::]:80 default_server;

       server_name  XXX.XXX.XXX.XXX;  #I changed this intentionally

       root         /usr/share/nginx/html;


        # Load configuration files for the default server block.

       # include /etc/nginx/default.d/*.conf;


       

location ~* /(\w+)/static/ {

       root /root/myapp/applications/;

    }


        location / {

       include uwsgi_params;

       uwsgi_pass unix:/run/uwsgi/myapp.sock;

        }        


        error_page 404 /404.html;

           location = /40x.html {

       }


        error_page 500 502 503 504 /50x.html;

           location = /50x.html {

       }

   }


    server {

       listen 443;

       server_name xxx.xxx.xxx.xxx; # I changed this intentionally


        ssl on;

       ssl_certificate /etc/nginx/ssl/myapp.crt;

       ssl_certificate_key /etc/nginx/ssl/myapp.key;


        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

       ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";

       ssl_prefer_server_ciphers on;


        location / {

           include uwsgi_params;

           uwsgi_pass unix:/run/uwsgi/myapp.sock;

       }

   }

}



I addition, I have a task. This clears sessions every two minutes.

MAIL=root
*/2 * * * * python /root/myapp/web2py.py -S Lia -M -R /root/myapp/scripts/
sessions2trash.py -A -o



I prefer to use jquery ajax function. I do not use web2py ajax function. I 
do this in order to better control the messages and sample windows. 

Here Javascript code:

*function *MostrarDetalle(NumID){
    $('#messageModal').modal('show');
    *var *parametros = {'var_NumID': NumID};
    $.ajax({
        url: "{{=URL(c='Pedidos', f='getdetalleGrid', args=request.args)}}",
        dataType:'html',
        type: 'POST',
        data: parametros,
        success: OnsuccessMostrarDetalle,
        error: OnerrorMostrarDetalle
    });

    *return false*;
}

    *function *OnsuccessMostrarDetalle(data){
    document.getElementById("bodymodaledit").innerHTML = data;
    $('#messageModal').modal('hide');
    $('#detallePedido').modal('show');
    setTimeout(*function *() {$('#det_pedido_Cod_Articulo').focus();}, 1000)
;

}

*function *OnerrorMostrarDetalle(e){
    *var *cadena = '<div class="alert alert-error"> <h3> Se encontraron 
errores </h3> <p>' + e.message + '</p> </div>';
    document.getElementById("bodymodaledit").innerHTML = cadena;
    $('#messageModal').modal('hide');
    $('#detallePedido').modal('show');
} 


My problema is:

When I have 10 or 15 users on line,  the following message appears at times 
in client browser:


*This webpage has a redirect loop*


In Spanish:

*Esta página tiene un bucle de redirección. *

Here some images:

<https://lh3.googleusercontent.com/-VqfcV2cwk2o/Vr-KqqDs5oI/AAAAAAAAKZg/t_wW94ygddI/s1600/redireccionamiento.png>

<https://lh3.googleusercontent.com/-FVSOMvpXuos/Vr-KuxALdOI/AAAAAAAAKZk/QJBexQUpwhg/s1600/redireccionamiento2.png>


Still I do not understand why this situation and I can not identify 
completely. I need your help to identify the problem.

Regards.










-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to