typora/note/devops/nginx/home.heysq,com.md
2024-12-12 10:48:55 +08:00

1.6 KiB

server {
    listen 8443 ssl;
    server_name home.heysq.com;
    ssl_certificate /etc/nginx/ssl/home_heysq_nginx/home.crt;
    ssl_certificate_key /etc/nginx/ssl/home_heysq_nginx/home.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;

    error_page 497 https://$http_host$request_uri;
    client_max_body_size 500m;

    location /gitea/ {
        proxy_pass http://gitea:3000/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /grafana/ {
        proxy_set_header Host $http_host;
        proxy_pass http://grafana:3000;
    }

    location /grafana/api/live/ {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $http_host;
        proxy_pass http://grafana:3000;
    }

    location /prometheus/ {
        auth_basic "Prometheus";
        auth_basic_user_file /etc/nginx/htpasswd_file;
        proxy_pass http://prometheus:9090;
    }

    location /kubepi {
        proxy_pass http://kubepi;
    }

    location /code/ {
      proxy_pass http://code-server:8080/;
      proxy_http_version 1.1;
      proxy_set_header Host $host:8443/code/;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection upgrade;
      proxy_set_header Accept-Encoding gzip;
      proxy_connect_timeout 600;
      proxy_set_header Origin "";
    }
}