
user  root;
worker_processes  1;

#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;
    underscores_in_headers on;
    #gzip  on;
    server {
        listen 80;
        server_name localhost;
        access_log  /usr/local/nginx/1.23.0/logs/host-http.18.218.235.145.access.log  main;
        underscores_in_headers on;
        location / {
            root   /root/detection/dist;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
    server {
        listen       80;
        server_name  wwww.iqiql.com iqiql.com www.qiql.top qiql.top www.qiql.net qiql.net;
        return 301 https://blog.qiql.net$request_uri;
    }
    server {
        listen       80;
        server_name  linearcalc.com www.linearcalc.com;
        rewrite ^(.*)$ https://$host$1 permanent;
    }
    server {
        listen       80;
        server_name  *.stokes.qiql.net;
        rewrite ^(.*)$ https://$host$1 permanent;
    }
    server {
        listen       80;
        server_name  *.ai.qiql.net;
        rewrite ^(.*)$ https://$host$1 permanent;
    }
    server {
        listen       80;
        server_name  *.qiql.net;
        rewrite ^(.*)$ https://$host$1 permanent;
    }
    server {
        listen       443 ssl;
        server_name  linearcalc.com www.linearcalc.com;
        ssl_certificate /etc/letsencrypt/live/linearcalc.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/linearcalc.com/privkey.pem;
        ssl_trusted_certificate  /etc/letsencrypt/live/linearcalc.com/chain.pem;
        access_log  /usr/local/nginx/1.23.0/logs/host-https.linearcalc.com.access.log  main;

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

        # ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;    #安全链接可选的加密协议
        ssl_prefer_server_ciphers  on;

        location / {
            alias /usr/local/nginx/1.23.0/www/linearcalc/;
            index  index.html index.htm;
        }
        error_page  500 502 503 504  /50x.html;

        location /50x.html {
            root   /usr/local/nginx/1.23.0/html;
        }
    }

    server {
        listen       443 ssl;
        server_name  jupyter.qiql.net;
        access_log  logs/host-https.jupyter.qiql.net.access.log  main;
        ssl_certificate /etc/letsencrypt/live/qiql.net/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/qiql.net/privkey.pem;
        ssl_trusted_certificate  /etc/letsencrypt/live/qiql.net/chain.pem;

        location / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Real-Scheme $scheme;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_pass http://127.0.0.1:7002;
            client_max_body_size 40G;
            # WebSocket support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";

            proxy_read_timeout 120s;
            proxy_next_upstream error;
            # proxy_redirect off;
            proxy_buffering off;

        }
        error_page  500 502 503 504  /50x.html;

        location /50x.html {
            root   /usr/local/nginx/1.23.0/html;
        }
    }

    server {
        listen       443 ssl;
        server_name  *.stokes.qiql.net;
        access_log  logs/host-https.*stokes.qiql.net.access.log  main;
        ssl_certificate /etc/letsencrypt/live/stokes.qiql.net/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/stokes.qiql.net/privkey.pem;
        ssl_trusted_certificate  /etc/letsencrypt/live/stokes.qiql.net/chain.pem;
        location / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_pass http://127.0.0.1:7001;
            client_max_body_size 40G;
        }
        error_page  500 502 503 504  /50x.html;

        location /50x.html {
            root   /usr/local/nginx/1.23.0/html;
        }
    }

    server {
        listen       443 ssl;
        server_name  *.ai.qiql.net;
        access_log  logs/host-https.*ai.qiql.net.access.log  main;
        ssl_certificate /etc/letsencrypt/live/ai.qiql.net/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/ai.qiql.net/privkey.pem;
        ssl_trusted_certificate  /etc/letsencrypt/live/ai.qiql.net/chain.pem;
        location / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_pass http://127.0.0.1:7001;
            client_max_body_size 40G;
        }
        error_page  500 502 503 504  /50x.html;

        location /50x.html {
            root   /usr/local/nginx/1.23.0/html;
        }
    }

    server {
        listen       443 ssl;
        server_name  *.qiql.net;
        access_log  logs/host-https.*.qiql.net.access.log  main;
        ssl_certificate /etc/letsencrypt/live/qiql.net/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/qiql.net/privkey.pem;
        ssl_trusted_certificate  /etc/letsencrypt/live/qiql.net/chain.pem;
        location / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_pass http://127.0.0.1:7001;
            client_max_body_size 40G;
        }
        error_page  500 502 503 504  /50x.html;

        location /50x.html {
            root   /usr/local/nginx/1.23.0/html;
        }
    }

}
