<p>I am testing out the Shared Persistent Volumes on my Cluster. I have created an EKS cluster on AWS, I have installed NFS server on one of the nodes, created PV&amp; PVC for the same. I am able to mount the volumes with multiple applications. But I am unable to access the html files from Nginx server as it throws <strong>403 Forbidden Error.</strong></p>
<p>Below are the screenshot of my NFS -Server, nginx where my data mounted on it with permissions</p>
<p><a href="https://i.stack.imgur.com/cdjFf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cdjFf.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/KD6Wn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KD6Wn.png" alt="enter image description here" /></a></p>
<p>I have deployed Nginx as Pod on my Cluster. Below are my Nginx configuration files</p>

<p>nginx.conf</p>
<pre><code>user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] &quot;$request&quot; '
                      '$status $body_bytes_sent &quot;$http_referer&quot; '
                      '&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;';

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

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}
</code></pre>


<p>conf.d/default.conf</p>
<pre><code>server {
    listen       80;
    listen  [::]:80;
    server_name  localhost;

    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}
</code></pre>

<p>nginx pod logs</p>

<pre><code>   *22 directory index of &quot;/usr/share/nginx/html/test/&quot; is forbidden, client: 10.14.20.128, server: localhost, request: &quot;GET /test/ HTTP/1.1&quot;, host: &quot;*.amazon.com&quot;
    getuser?index=0 HTTP/1.1&quot;, host: &quot;3.124.54.114:80&quot;
    10.14.20.178 - - [07/Jun/2021:08:59:10 +0000] &quot;GET /config/getuser?index=0 HTTP/1.1&quot; 404 153 &quot;-&quot; &quot;Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0&quot; &quot;-&quot;
    2021/06/07 09:03:30 [error] 30#30: *1788 directory index of &quot;/usr/share/nginx/html/test1/&quot; is forbidden, client: 10.14.21.153, server: localhost, request: &quot;GET /test1/ HTTP/1.1&quot;, host: &quot;.elb.amazonaws.com&quot;
    10.14.21.153 - - [07/Jun/2021:09:03:30 +0000] &quot;GET /test1/ HTTP/1.1&quot; 403 555 &quot;-&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36&quot; &quot;-&quot;
    10.14.21.153 - - [07/Jun/2021:09:12:30 +0000] &quot;GET / HTTP/1.1&quot; 403 153 &quot;-&quot; &quot;Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1&quot; &quot;-&quot;
    2021/06/07 09:12:30 [error] 30#30: *1953 directory index of &quot;/usr/share/nginx/html/&quot; is forbidden, client: 10.14.21.153, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;35.157.4.133&quot;
    10.14.21.153 - - [07/Jun/2021:09:12:30 +0000] &quot;GET /HNAP1/ HTTP/1.1&quot; 404 153 &quot;http://35.157.4.133/&quot; &quot;Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1&quot; &quot;-&quot;
    2021/06/07 09:12:30 [error] 30#30: *1954 &quot;/usr/share/nginx/html/HNAP1/index.html&quot; is not found (2: No such file or directory), client: 10.14.21.153, server: localhost, request: &quot;GET /HNAP1/ HTTP/1.1&quot;, host: &quot;35.157.4.133&quot;, referrer: &quot;http://35.157.4.133/&quot;
    2021/06/07 09:55:33 [error] 30#30: *2729 directory index of &quot;/usr/share/nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
    127.0.0.1 - - [07/Jun/2021:09:55:33 +0000] &quot;GET / HTTP/1.1&quot; 403 153 &quot;-&quot; &quot;curl/7.64.0&quot; &quot;-&quot;
    2021/06/07 10:02:47 [error] 30#30: *2828 directory index of &quot;/usr/share/nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
    127.0.0.1 - - [07/Jun/2021:10:02:47 +0000] &quot;GET / HTTP/1.1&quot; 403 153 &quot;-&quot; &quot;curl/7.64.0&quot; &quot;-&quot;
</code></pre>


Nishar sheik
<p>I was able to resolve the issue. When you are installing NFS-server (Considering it as Master) on EC2 instances we have to make sure we are mounting the NFS server path on other EC2 instance (Considering it as a Client) &amp; Applying relevant Chmod permissions we will be able to access the files via nginx</p>
