#location __PATH__ {
#       alias __FINALPATH__;
#       if ($scheme = http) {
#              rewrite ^ https://$server_name$request_uri? permanent;
#       }
#       index index.php index.html index.htm;
#       default_type text/html;
#       location ~ [^/]\.php(/|$) {
#           fastcgi_split_path_info ^(.+?\.php)(/.*)$;
#           fastcgi_pass unix:/var/run/php5-fpm.sock;
#           fastcgi_index index.php;
#           include fastcgi_params;
#           fastcgi_param  REMOTE_USER $remote_user;
#           fastcgi_param  PATH_INFO $fastcgi_path_info;
#       }
#
  # Include SSOWAT user panel.
#  include conf.d/yunohost_panel.conf.inc;
#}




#server {
#    listen 80;
#    root /path/to/lutim/public;

    # This is important for user's privacy !
#    access_log off;
#    error_log /var/log/nginx/lutim.error.log;

    # This is important ! Make it OK with your Lutim configuration
    client_max_body_size 40M;

    location ~* ^/(img|css|font|js)/ {
        try_files $uri @lutim;
        add_header Expires "Thu, 31 Dec 2037 23:55:55 GMT";
        add_header Cache-Control "public, max-age=315360000";

        # HTTPS only header, improves security
        #add_header Strict-Transport-Security "max-age=15768000";
    }

#    location / {
    location __PATH__ {
#alias __FINALPATH__;
        try_files $uri @lutim;

        # HTTPS only header, improves security
        #add_header Strict-Transport-Security "max-age=15768000";
    }

    location @lutim {
        # Adapt this to your configuration
        # My advice: put a varnish between nginx and Lutim, it's really useful when images are widel$
        proxy_pass  http://127.0.0.1:8080;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        # If you want to log the remote port of the image senders, you'll need that
        proxy_set_header X-Remote-Port $remote_port;

        # Lutim reads this header and understands that the current session is actually HTTPS.
        # Enable it if you run a HTTPS server (in this case, don't forgot to change the listen port $
        #proxy_set_header X-Forwarded-Proto https;

        # We expect the downsteam servers to redirect to the right hostname, so don't do any rewrite$
        proxy_redirect     off;
    }
#}