server/nginx.conf

59 lines
1.6 KiB
Nginx Configuration File
Raw Normal View History

2013-10-09 16:07:09 +00:00
server {
2013-12-11 11:58:17 +00:00
listen 443 ssl;
2013-12-11 16:20:26 +00:00
listen [::]:443 ipv6only=on ssl;
root /var/www/fic2014-server/htdocs/;
2013-10-09 16:07:09 +00:00
access_log /var/log/nginx/fic.access_log;
2013-12-11 11:58:17 +00:00
error_log /var/log/nginx/fic.error_log;
2013-10-09 16:07:09 +00:00
2013-12-11 16:20:26 +00:00
ssl_certificate /var/www/fic2014-server/misc/server.crt;
ssl_certificate_key /var/www/fic2014-server/misc/server.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:!ADH:!AECDH:!MD5:!DSS;
ssl_client_certificate /var/www/fic2014-server/misc/pki/cacert.crt;
ssl_verify_client on;
2013-12-11 11:58:17 +00:00
add_header Strict-Transport-Security "max-age=2592000; includeSubdomains";
2013-12-11 16:20:26 +00:00
location /
2013-12-11 11:58:17 +00:00
{
2013-12-11 16:20:26 +00:00
default_type text/html;
if ($ssl_client_s_dn !~ "/C=FR/ST=France/O=Epita/OU=SRS/")
{
return 401;
}
2013-10-09 16:07:09 +00:00
2013-12-11 16:20:26 +00:00
if ($ssl_client_s_dn ~ "/C=FR/ST=France/O=Epita/OU=SRS/CN=Team1/") {
root /var/www/fic2014-server/htdocs/connected/166$1;
2013-10-09 16:07:09 +00:00
2013-12-11 16:20:26 +00:00
rewrite ^/submission-([0-9]+)-([0-9]+).html$ /submission.php?team=166&theme=$1&exercice=$2 last;
}
2013-10-09 16:07:09 +00:00
}
location ~* \favicon.ico$ {
2013-12-11 16:20:26 +00:00
access_log off;
expires 1d;
add_header Cache-Control public;
2013-10-09 16:07:09 +00:00
}
2013-11-08 14:47:55 +00:00
location ~ ^/(img|js|css)/ {
2013-12-11 16:20:26 +00:00
access_log off;
expires 7d;
add_header Cache-Control public;
2013-10-09 16:07:09 +00:00
}
location ~ /(\.ht|\.git|\.svn|\.onyx) {
2013-12-11 16:20:26 +00:00
return 403;
2013-10-09 16:07:09 +00:00
}
2013-12-11 16:20:26 +00:00
location /submission.php
2013-10-09 16:07:09 +00:00
{
2013-12-11 16:20:26 +00:00
root /var/www/fic2014-server/;
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/var/run/fastcgi/php-fpm.sock;
2013-10-09 16:07:09 +00:00
break;
}
2013-12-11 16:20:26 +00:00
2013-10-09 16:07:09 +00:00
}