
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;

    #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 www.gitlab.zors.dev  gitlab.zors.dev;
#    listen 8929 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
#    location /gitlab {
#        proxy_pass https://100.8.182.111:8929/users/sign_in;
#    }

#    location / {
#        proxy_pass https://100.8.182.111:8929/users/sign_in;
#    }
#}

server {
   server_name blog.zors.dev  wordpress.zors.dev;
   #listen 80;
   #listen 8001;
   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://blog.zors.dev;
       #proxy_pass http://100.8.182.111:8001;
       #proxy_pass https://blog.zors.dev;
       #proxy_pass  http://192.168.1.180:8000;
       proxy_pass http://100.8.182.111:8000;
   }
}

server {
    server_name files.zors.dev  zors.dev  www.zors.dev;
    #listen 8000;
    #access_log  /var/log/nginx/host.access.log  main;


    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;
         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/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 /gitlab/ {
        #alias /mnt/z/nginxFileServe/;
        #alias   "/mnt/z/nginxFileServe/PhotoGallery/Greece 2019/";
        #autoindex on;
        #autoindex_format xml;
        #xslt_string_param title $1;
        #xslt_stylesheet gal4.xslt;
        #try_files $uri $uri/ =404;
        #proxy_pass https://100.8.182.111;
        #proxy_pass https://100.8.182.111:8929/users/sign_in;
        #proxy_pass https://100.8.182.111:8929/;
        #proxy_pass https://zors.dev:8929/gitlab/;
        #listen 8929 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
        #proxy_set_header Host $host;
        #proxy_pass https://100.8.182.111:8929/gitlab;
    #}
    #location /users/sign_up {
    #    proxy_pass https://100.8.182.111:8929/gitlab/;
        #proxy_set_header Host $host;
        #proxy_pass https://100.8.182.111:8929/gitlab;
    #}
    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 "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
   
   #listen 8929 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

    # john certbot test
   #listen 8929 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 {
#    if ($host = zors.dev) {
#        return 301 https://$host$request_uri;
#    } # managed by Certbot

#    server_name  zors.dev;
#    listen 80;
#    return 404; # 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.8.182.111: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.8.182.111:3000;
   }
}

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 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.8.182.111:8080;
   }
}

#server {
#    server_name  69.115.126.200;
#    listen 80;
#    return 301 $https://zors.dev$request_uri; 
#}


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
#	location /zors {
#		alias /usr/share/nginx/html/nonhtml/;
#		autoindex on;
#		autoindex_exact_size off;
	#}

    # location "/PhotoGallery/Greece 2019" {
    #     alias   "/mnt/z/nginxFileServe/PhotoGallery/Greece 2019/";
    #     autoindex on;
    #     autoindex_format xml;
    #     xslt_string_param title $1;
    #     xslt_stylesheet gal4.xslt;
    #     try_files $uri $uri/ =404;
    # }
    # location "/PhotoGallery/Wallpaper" {
    #     alias   "/mnt/z/nginxFileServe/PhotoGallery/Wallpaper/";
    #     autoindex on;
    #     autoindex_format xml;
    #     xslt_string_param title $1;
    #     xslt_stylesheet gal4.xslt;
    #     try_files $uri $uri/ =404;
    # }
    # location "/PhotoGallery/Greece 2021" {
    #     alias   "/mnt/z/nginxFileServe/PhotoGallery/Greece 2021/";
    #     autoindex on;
    #     autoindex_format xml;
    #     xslt_string_param title $1;
    #     xslt_stylesheet gal4.xslt;
    #     try_files $uri $uri/ =404;
    # }
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}
