aluttik / go-crossplane

An unofficial Go port of the NGINX config/JSON converter crossplane
Apache License 2.0
50 stars 15 forks source link

bro #16

Closed mingmingshiliyu closed 11 months ago

mingmingshiliyu commented 11 months ago
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
    worker_connections 1024;
    multi_accept on;
}

http {
    default_type application/octet-stream;

    access_log /var/log/nginx/access.log;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;

    keepalive_timeout 65;
    types_hash_max_size 2048;

    server {
        listen 80;
        server_name example.com;
        root /var/www/html;

        location / {
            try_files $uri $uri/ =404;
        }

        location /api/ {
            proxy_pass http://localhost:3000;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location /images/ {
            alias /var/www/images/;
            try_files $uri $uri/ =404;
        }

        location ~ /\.ht {
            deny all;
        }
    }

    server {
        listen 443 ssl http2;
        server_name example.com;
        root /var/www/html;

        ssl_certificate /etc/nginx/ssl/cert.pem;
        ssl_certificate_key /etc/nginx/ssl/privkey.pem;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_ciphers HIGH:!aNULL:!MD5;

        location / {
            try_files $uri $uri/ =404;
        }
    }
}

when i use

var payload crossplane.Payload
    if err = json.Unmarshal(content, &payload); err != nil {
        panic(err)
    }

an error happened panic: invalid character 'w' looking for beginning of value [recovered] panic: invalid character 'w' looking for beginning of value