
user  nginx;
worker_processes  auto;

#load_module modules/ngx_http_xslt_filter_module.so;
load_module modules/ngx_http_fancyindex_module.so;
#load_module /usr/lib/nginx/modules/ngx_http_passenger_module.so;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    client_max_body_size 10000M;
    #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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    gzip  on;
    gzip_comp_level    9;
    gzip_proxied       any;
    gzip_vary          on;
    gzip_min_length 1000;
    gzip_types
        application/atom+xml
        application/javascript
        application/json
        application/ld+json
        application/manifest+json
        application/rss+xml
        application/vnd.geo+json
        application/vnd.ms-fontobject
        application/x-font-ttf
        application/x-web-app-manifest+json
        application/xhtml+xml
        application/xml
        font/opentype
        image/bmp
        image/png
        image/jpg
        image/jpeg
        image/svg+xml
        image/x-icon
        text/cache-manifest
        text/css
        text/plain
        text/vcard
        text/vnd.rim.location.xloc
        text/vtt
        text/x-component
        text/x-cross-domain-policy;
    #gunzip on;

server {
    server_name  zors.dev  www.zors.dev  files.zors.dev;

    #access_log  /var/log/nginx/host.access.log  main;
    location /upload {
        # auth_basic "Auth required to upload";
        # auth_basic_user_file /usr/local/nginx/httpbasic.htpasswd;
        client_max_body_size 9999M;  # Allow file uploads up to 9999 MB
        proxy_pass http://localhost:3000/upload;  # Forward to the Node.js server
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

    location ~ "/PhotoGallery/([0-9A-z_\-. ]+)/$" 
    {
         root /mnt/z/nginxFileServe/;
         #alias   "/mnt/z/nginxFileServe/PhotoGallery/Greece 2019/";
         autoindex on;
         autoindex_format xml;
         xslt_string_param title $1;
         #xslt_stylesheet gal4.xslt;
         xslt_stylesheet gal5.xslt;
         try_files $uri $uri/ =404;
   }

	location /protected {
		auth_basic 	"Private Files";
		#auth_basic_user_file /etc/nginx/httpbasic.htpasswd;
        auth_basic_user_file /usr/local/nginx/httpbasic.htpasswd;
		alias  "/mnt/z/nginxFileServe/protected/";
		#autoindex on;

        fancyindex on;
        fancyindex_localtime on;
        fancyindex_exact_size off;
        fancyindex_header "/Nginx-Fancyindex-Theme-dark/header.html";
        fancyindex_footer "/Nginx-Fancyindex-Theme-dark/footerWithUpload.html";
        fancyindex_ignore "examplefile.html"; # Ignored files will not show up in the directory listing, but will still be public. 
        fancyindex_ignore "Nginx-Fancyindex-Theme-light"; # Making sure folder where files are don't show up in the listing. 
        fancyindex_ignore "Nginx-Fancyindex-Theme-dark"; # Making sure folder where files are don't show up in the listing. 
	}
	location /sig_santa/JACOB {
		auth_basic 	"CONGRATULATIONS BOTTERS, YOU ARE MY SIG SANTA RECIPIENT";
		#auth_basic_user_file /etc/nginx/httpbasic.htpasswd;
        auth_basic_user_file /usr/local/nginx/httpbasic.htpasswd;
		alias  "/mnt/z/nginxFileServe/sig_santa/JACOB";
		#autoindex on;

        fancyindex on;
        fancyindex_localtime on;
        fancyindex_exact_size off;
        fancyindex_header "/Nginx-Fancyindex-Theme-dark/header.html";
        fancyindex_footer "/Nginx-Fancyindex-Theme-dark/footer.html";
        fancyindex_ignore "examplefile.html"; # Ignored files will not show up in the directory listing, but will still be public. 
        fancyindex_ignore "Nginx-Fancyindex-Theme-light"; # Making sure folder where files are don't show up in the listing. 
        fancyindex_ignore "Nginx-Fancyindex-Theme-dark"; # Making sure folder where files are don't show up in the listing. 
	}
location /sig_santa {
		auth_basic 	"OLD SIG SANTA VODS";
		#auth_basic_user_file /etc/nginx/httpbasic.htpasswd;
        auth_basic_user_file /usr/local/nginx/httpbasic.htpasswd;
		alias  "/mnt/z/nginxFileServe/sig_santa";
		#autoindex on;

        fancyindex on;
        fancyindex_localtime on;
        fancyindex_exact_size off;
        fancyindex_header "/Nginx-Fancyindex-Theme-dark/header.html";
        fancyindex_footer "/Nginx-Fancyindex-Theme-dark/footer.html";
        fancyindex_ignore "examplefile.html"; # Ignored files will not show up in the directory listing, but will still be public. 
        fancyindex_ignore "Nginx-Fancyindex-Theme-light"; # Making sure folder where files are don't show up in the listing. 
        fancyindex_ignore "Nginx-Fancyindex-Theme-dark"; # Making sure folder where files are don't show up in the listing. 
	}

location /sig_santa/2022 {
        root /mnt/z/nginxFileServe/;
         #alias   "/mnt/z/nginxFileServe/PhotoGallery/Greece 2019/";
         autoindex on;
         autoindex_format xml;
         xslt_string_param title $1;
         #xslt_stylesheet gal4.xslt;
         xslt_stylesheet gal5.xslt;
         try_files $uri $uri/ =404;
	}
location /sig_santa/2023 {
         root /mnt/z/nginxFileServe/;
         #alias   "/mnt/z/nginxFileServe/PhotoGallery/Greece 2019/";
         autoindex on;
         autoindex_format xml;
         xslt_string_param title $1;
         #xslt_stylesheet gal4.xslt;
         xslt_stylesheet gal5.xslt;
         try_files $uri $uri/ =404;
	}
    location / {
        #root   /usr/share/nginx/html;
        #index  index.html index.htm;
        alias /mnt/z/nginxFileServe/;
        #autoindex on;
        fancyindex on;
        fancyindex_localtime on;
        fancyindex_exact_size off;
        fancyindex_header "/Nginx-Fancyindex-Theme-dark/header.html";
        fancyindex_footer "/Nginx-Fancyindex-Theme-dark/footer.html";
        #fancyindex_header "header.html";
        #fancyindex_footer "footer.html";
        #fancyindex_header "/mnt/z/nginxFileServe/Nginx-Fancyindex-Theme-dark/header.html";
        #fancyindex_footer "/mnt/z/nginxFileServe/Nginx-Fancyindex-Theme-dark/footer.html";
        fancyindex_ignore "examplefile.html"; # Ignored files will not show up in the directory listing, but will still be public. 
        fancyindex_ignore "photogalleryhomefinal.png"; # Ignored files will not show up in the directory listing, but will still be public. 
        fancyindex_ignore "Nginx-Fancyindex-Theme-light"; # Making sure folder where files are don't show up in the listing. 
        fancyindex_ignore "Nginx-Fancyindex-Theme-dark"; # Making sure folder where files are don't show up in the listing. 
        # Warning: if you use an old version of ngx-fancyindex, comment the last line if you
        # encounter a bug. See https://github.com/Naereen/Nginx-Fancyindex-Theme/issues/10
        fancyindex_name_length 255; # Maximum file name length in bytes, change as you like.
    }
    
    location = /favicon.ico {
        alias /etc/nginx/favicon/favicon.ico;
    }
    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }


#    listen 443 ssl; # managed by Certbot
#    ssl_certificate /etc/letsencrypt/live/zors.dev/fullchain.pem; # managed by Certbot
#    ssl_certificate_key /etc/letsencrypt/live/zors.dev/privkey.pem; # managed by Certbot
#    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
#    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


   listen 443 ssl; # managed by Certbot
   ssl_certificate /etc/letsencrypt/live/zors.dev-0001/fullchain.pem; # managed by Certbot
   ssl_certificate_key /etc/letsencrypt/live/zors.dev-0001/privkey.pem; # managed by Certbot
   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
   
}
server {
   server_name gitlab.zors.dev;
   listen 443 ssl; # managed by Certbot
   ssl_certificate /etc/letsencrypt/live/zors.dev-0001/fullchain.pem; # managed by Certbot
   ssl_certificate_key /etc/letsencrypt/live/zors.dev-0001/privkey.pem; # managed by Certbot
   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

   #return 301 https://gitlab.zors.dev/$request_uri;

   location / {
       proxy_pass https://100.35.27.207:8929;
   }
}

server {
   server_name wiki.zors.dev;
   listen 443 ssl; # managed by Certbot
   ssl_certificate /etc/letsencrypt/live/zors.dev-0001/fullchain.pem; # managed by Certbot
   ssl_certificate_key /etc/letsencrypt/live/zors.dev-0001/privkey.pem; # managed by Certbot
   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

   #return 301 https://gitlab.zors.dev/$request_uri;

   location / {
       proxy_pass http://100.35.27.207:3000;
   }
}

server {
   server_name tracker.zors.dev;
   listen 443 ssl; # managed by Certbot
   ssl_certificate /etc/letsencrypt/live/zors.dev-0001/fullchain.pem; # managed by Certbot
   ssl_certificate_key /etc/letsencrypt/live/zors.dev-0001/privkey.pem; # managed by Certbot
   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

   #return 301 https://gitlab.zors.dev/$request_uri;

   location / {
       proxy_pass http://100.35.27.207:8080;
    #    proxy_pass http://192.168.1.1:8080;
   }
}

server {
   server_name blog.zors.dev  ghost.zors.dev;
   listen 443 ssl; # managed by Certbot
   ssl_certificate /etc/letsencrypt/live/zors.dev-0001/fullchain.pem; # managed by Certbot
   ssl_certificate_key /etc/letsencrypt/live/zors.dev-0001/privkey.pem; # managed by Certbot
   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

   #return 301 https://gitlab.zors.dev/$request_uri;

   location / {
       proxy_pass http://100.35.27.207:8000;
   }
}

server {
   server_name connect.zors.dev;
   listen 443 ssl; # managed by Certbot
   ssl_certificate /etc/letsencrypt/live/zors.dev-0001/fullchain.pem; # managed by Certbot
   ssl_certificate_key /etc/letsencrypt/live/zors.dev-0001/privkey.pem; # managed by Certbot
   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

   #return 301 https://gitlab.zors.dev/$request_uri;

   location / {
       proxy_pass http://100.35.27.207:5173;
   }
}
# server {
#    server_name pihole.zors.dev;
#    listen 443 ssl; # managed by Certbot
#    ssl_certificate /etc/letsencrypt/live/zors.dev-0001/fullchain.pem; # managed by Certbot
#    ssl_certificate_key /etc/letsencrypt/live/zors.dev-0001/privkey.pem; # managed by Certbot
#    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
#    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

#    #return 301 https://gitlab.zors.dev/$request_uri;

#    location / {
#        proxy_pass http://192.168.1.115;
#    }
# }

# server {
#    server_name router.zors.dev;
#    listen 443 ssl; # managed by Certbot
#    ssl_certificate /etc/letsencrypt/live/zors.dev-0001/fullchain.pem; # managed by Certbot
#    ssl_certificate_key /etc/letsencrypt/live/zors.dev-0001/privkey.pem; # managed by Certbot
#    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
#    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

#    #return 301 https://gitlab.zors.dev/$request_uri;

#    location / {
#        proxy_pass https://192.168.1.1:8443;
#    }
# }
}
