server { listen 80; server_name action.paris12.pcf.fr; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name action.paris12.pcf.fr; access_log /var/log/nginx/action/access.log; error_log /var/log/nginx/action/error.log; ssl_certificate /etc/letsencrypt/live/action.paris12.pcf.fr/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/action.paris12.pcf.fr/privkey.pem; root /var/www/action; index index.php; location ~ [a-zA-Z0-9]+/admin.*$ { auth_basic "Halte ! Qui va la ?"; auth_basic_user_file /etc/nginx/htpasswd; rewrite "^/([a-zA-Z0-9]{24})/admin$" "/adminstuds.php?poll=$1" last; rewrite "^/([a-zA-Z0-9]{24})/admin/vote/([a-zA-Z0-9]{16})$" "/adminstuds.php?poll=$1&vote=$2" last; rewrite "^/([a-zA-Z0-9]{24})/admin/action/([a-zA-Z_-]+)(/(.+))?$" "/adminstuds.php?poll=$1&$2=$3" last; location ~ \.php { include api_fastcgi.conf; } } location ~ /([a-zA-Z0-9]+) { rewrite "^/([a-zA-Z0-9]+)/action/([a-zA-Z_-]+)/(.+)$" "/studs.php?poll=$1&$2=$3" last; rewrite "^/([a-zA-Z0-9]+)/vote/([a-zA-Z0-9]{16})" "/studs.php?poll=$1&vote=$2" last; rewrite "^/([a-zA-Z0-9]+)$" "/studs.php?poll=$1" last; location ~ \.php { include api_fastcgi.conf; } } location ~ /(|index.php|create_poll.php?type=.+)$ { auth_basic "Acces a la creation de sondage restreint..."; auth_basic_user_file /etc/nginx/htpasswd; location ~ \.php { include api_fastcgi.conf; } } location ~ \.php { include api_fastcgi.conf; } }