#server {
#    listen 80;
#    listen [::]:80;
#    server_name hagavastgoedmanagement.nl www.hagavastgoedmanagement.nl;
#
#        root /var/www/html/vhosts/hagavastgoedmanagement.nl;
#        index index.php index.html;
#        access_log /var/log/nginx/hagavastgoedmanagement.nl.access.log;
#        error_log /var/log/nginx/hagavastgoedmanagement.nl.error.log;
#
#        location / {
#            try_files $uri $uri/ /index.php?$args;
#        }
#
#        location ~ \.php$ {
#            include fastcgi_params;
#            fastcgi_pass unix:/run/php-fpm/www.sock;
#            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#            fastcgi_param HTTPS on;
#        }
#
#}
server {
    listen 443 ssl;
    server_name hagavastgoedmanagement.nl www.hagavastgoedmanagement.nl;
    access_log /var/log/nginx/hagavastgoedmanagement.nl_access_log;
    error_log /var/log/nginx/hagavastgoedmanagement.nl_error_log;
    include /etc/nginx/certificates/nahvastgoedmanagement_ssl;
#    include /etc/nginx/conf.d/tible_security_settings;


    client_max_body_size 128m;

    root /var/www/html/vhosts/hagavastgoedmanagement.nl;
    index index.php index.html index.htm;
#    if ($host ~* ^hagavastgoedmanagement.nl$) {
#        return  301 https://www.hagavastgoedmanagement.nl$request_uri;
#    }

    location / {
       try_files $uri  /index.php?$args;
       location ~* \.(jpg|jpeg|gif|css|png|js|ico|woff|ttf|woff2)$ {
         expires 365d;
      }
    }

   # location ~ ^/job/ {
   #    try_files $uri $uri/ /index.php?page=$request_uri;
   #    location ~* \.(jpg|jpeg|gif|css|png|js|ico|woff|ttf|woff2)$ {
   #      expires 365d;
   #   }
   # }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass  unix:/run/php-fpm/www.sock;
        fastcgi_read_timeout 240;
        fastcgi_index index.php;
        try_files               $uri =404;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }



    location @fallback {
        include fastcgi_params;
        fastcgi_pass  unix:/run/php-fpm/www.sock;
        fastcgi_index index.php;
        fastcgi_read_timeout 240;
        try_files               $uri =404;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ ^/(.*\.(ac3|avi|bmp|bz2|css|cue|dat|doc|docx|dts|exe|flv|gif|gz|htm|html|ico|img|iso|jpeg|jpg|js|mkv|mp3|mp4|mpeg|mpg|ogg|pdf|png|ppt|pptx|qt|rar|rm|swf|tar|tgz|txt|wav|xls|xlsx|zip))$ {
        try_files $uri @fallback;
    }

   location ~ /.svn/ {
      deny all;
    }
#BLOCK XMLRPC ATTACK
   location = /xmlrpc.php {
    deny all;
    access_log off;
    log_not_found off;
    return 444;
  }
}