Score:0

13: Permission denied nginx

us flag

I have two appliccations (nginx) and (springboot) in a vps (Centos 7).

I have a proxy that work fine.

When i request from localhost to vps(springboot) it works fine, but when i request from vps(nginx) to vps(springboot) it broke. All request work fine but this one in particular doesn't.

the error is:

2021/11/08 18:51:24 [crit] 890#890: *42 open() "/var/lib/nginx/tmp/client_body/0000000005" failed (13: Permission denied), client: 200.123.141.195, server: example.com.ar, request: "POST /api/slideshow/modify/picture HTTP/1.1", host: "example.com.ar", referrer: "https://example.com.ar/slideshow"

this is the angular code:

 private urlEndPoint: string = 'api/slideshow';
    addPhoto(): Observable<HttpEvent<{}>> {
       let req = new HttpRequest('POST', `${this.urlEndPoint}/modify/picture`, formData, {
          reportProgress: true
       });
       return this.http.request(req);
    }

this is the conf.d

server {
    listen 80 ;
    server_name example.com.ar;
    server_name www.example.com.ar;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
        server_name www.example.com.ar;

    ssl_certificate /etc/letsencrypt/live/example.com.ar-0001/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com.ar-0001/privkey.pem;
        return 301 https://example.com.ar$request_uri;
}

server {
    listen          443 ssl;
#        server_name    www.example.com.ar;
    server_name     example.com.ar;
    
    ssl_certificate     /etc/letsencrypt/live/example.com.ar/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com.ar/privkey.pem;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log error;
    
    root /var/www/html/;

    location / {
        if (!-e $request_filename){
            rewrite ^(.*)$ /index.html break;
        }
    }


    location ~ ^/api$ {
        set $myargs $args;  # workaround to encode spaces in query string!
        return 303 $scheme://$server_name/api/$is_args$myargs;
    }

    location /api/ {
        proxy_pass  https://example.com.ar:8080/;
                
        proxy_http_version 1.1;
                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;
                proxy_set_header X-Forwarded-Host  $host;
                proxy_set_header X-Forwarded-Port  $server_port;

        add_header 'Access-Control-Allow-Origin' '*';
            add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, PUT, OPTIONS';
            add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
            add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';

    }
}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.