Wordpress + Nginx - openat() ... failed (13: Permission denied)

Discussion in 'Installation/Configuration' started by Hanz1711, May 13, 2021.

  1. Hanz1711

    Hanz1711 New Member

    Hello,

    in the web log, whenever you call the wordpress plugin I get this error
    Code:
    2021/05/13 21:55:44 [crit] 2918#2918: *15 openat() "/var/www/finance.smidl.online/finance/" failed (13: Permission denied), client: 52.212.240.116, server: finance.smidl.online, request: "POST /?rest_route=%2Ffapi%2Fv1%2Fcallback&level%5B0%5D=55&days=14 HTTP/1.1", host: "finance.smidl.online", referrer: "api.fapi.cz"
    nginx.conf
    Code:
    user www-data;
    worker_processes auto;
    pid /run/nginx.pid;
    include /etc/nginx/modules-enabled/*.conf;
    
    events {
            worker_connections 1024;
            # multi_accept on;
    }
    
    http {
    
    map $remote_addr $ip_anonym1 {
    default 0.0.0;
    "~(?P<ip>(\d+)\.(\d+)\.(\d+))\.\d+" $ip;
    "~(?P<ip>[^:]+:[^:]+):" $ip;
    }
    
    map $remote_addr $ip_anonym2 {
    default .0;
    "~(?P<ip>(\d+)\.(\d+)\.(\d+))\.\d+" .0;
    "~(?P<ip>[^:]+:[^:]+):" ::;
    }
    
    map $ip_anonym1$ip_anonym2 $ip_anonymized {
    default 0.0.0.0;
    "~(?P<ip>.*)" $ip;
    }
    
    log_format anonymized '$ip_anonymized - $remote_user [$time_local] '
    '"$request" $status $body_bytes_sent '
    '"$http_referer" "$http_user_agent"';
    
    
            ##
            # Basic Settings
            ##
    
            sendfile on;
            tcp_nopush on;
      tcp_nodelay on;
            keepalive_timeout 65;
            types_hash_max_size 2048;
            # server_tokens off;
    
            # server_names_hash_bucket_size 64;
            # server_name_in_redirect off;
    
            include /etc/nginx/mime.types;
            default_type application/octet-stream;
    
            ##
            # SSL Settings
            ##
    
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
            ssl_prefer_server_ciphers on;
    
            ##
            # Logging Settings
            ##
    
            access_log /var/log/nginx/access.log;
            error_log /var/log/nginx/error.log;
    
            ##
            # Gzip Settings
            ##
    
            gzip on;
    
            # gzip_vary on;
            # gzip_proxied any;
            # gzip_comp_level 6;
            # gzip_buffers 16 8k;
            # gzip_http_version 1.1;
            # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
    
            ##
         ##
            # Virtual Host Configs
            ##
    
            include /etc/nginx/conf.d/*.conf;
            include /etc/nginx/sites-enabled/*;
    }
    
    
    Where could the problem be?
     
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I think nginx.conf is the least to do with the problems and you should look into your wp domain logs and vhost but I would normally check if I got the necessary wp nginx directive in the vhost before checking the logs for error.
     
  3. Hanz1711

    Hanz1711 New Member

    Could I ask for more specific guidance? The site log reports that the third-party service does not have API permissions to the site folder.
    Code:
    2021/05/13 21:55:44 [crit] 2918#2918: *15 openat() "/var/www/finance.smidl.online/finance/" failed (13: Permission denied), client: 52.212.240.116, server: finance.smidl.online, request: "POST /?rest_route=%2Ffapi%2Fv1%2Fcallback&level%5B0%5D=55&days=14 HTTP/1.1", host: "finance.smidl.online", referrer: "api.fapi.cz"
    Is it possible that this is by setting permissions on folders and files? Folders have 755 and 644 files.
     

Share This Page