title: Nginx 403 Forbidden for location and localhost
body: <p>My target is to access to a specific location (i.e. phpmyadmin) using an SSH tunnel <a href="http://localhost/phpmyadmin" rel="nofollow noreferrer">http://localhost/phpmyadmin</a></p>
  
  <p>I have just installed Ubuntu 20.04 with Nginx. The following configuration was working fine with Ubuntu 18.04.</p>
  
  <p>I edited /etc/nginx/sites-available/default adding:</p>
  
  <pre><code>  location /phpmyadmin {
      #Allow localhost
      allow 127.0.0.1;
      #deny all the others ip
      deny all;
    }
  </code></pre>
  
  <p>when I access to <a href="http://localhost/phpmyadmin" rel="nofollow noreferrer">http://localhost/phpmyadmin</a> I receive the error message:</p>
  
  <blockquote>
    <p>403 Forbidden nginx/1.17.10 (Ubuntu)</p>
  </blockquote>
  
  <p>Just for testing I have removed "deny all;" everything it is working fine, but every ip address can access the location phpmyadmin.</p>
  
  <p>error log nginx:</p>
  
  <blockquote>
    <p>2020/05/05 23:52:13 [error] 21905#21905: *1 access forbidden by rule, client: ::1, server: _, request: "GET /phpmyadmin/ HTTP/1.1", host: "localhost"</p>
  </blockquote>
  
  <pre><code>server {
      listen 80 default_server;
      listen [::]:80 default_server;
  
  
      root /var/www/html;
  
      # Add index.php to the list if you are using PHP
      index index.html index.htm index.nginx-debian.html index.php;
  
      server_name _;
  
      location / {
              # First attempt to serve request as file, then
              # as directory, then fall back to displaying a 404.
              try_files $uri $uri/ =404;
      }
  
     # pass PHP scripts to FastCGI server
      #
      location ~ \.php$ {
              include snippets/fastcgi-php.conf;
  
              # With php-fpm (or other unix sockets):
              fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
              # With php-cgi (or other tcp sockets):
              #fastcgi_pass 127.0.0.1:9000;
      }
  
  
  location /phpmyadmin {
      satisfy all;
      allow 127.0.0.1;
      deny all;
      }
  
  
     }
  </code></pre>
  
  <p>Any idea why this configuration is not working anymore with ubuntu 20.04 and nginx 1.17.10?</p>