title: phpMyAdmin 502 bad gateway [CentOS7, nginx]
body: <p>I'm studying centos7 and nginx. I can display index.html with cerbot SSL.
  And I installed phpmyAdmin then I open <a href="https://mywebsite.com/phpMyAdmin/" rel="nofollow noreferrer">https://mywebsite.com/phpMyAdmin/</a>
  I got 502 Bad Gateway errir
  Could someone teach me right way please?</p>
  <p>Here is my log.</p>
  <pre><code>2021/05/01 17:23:08 [error] 15816#15816: *103 connect() failed (111: Connection refused) while connecting to upstream, client: 125.xxx.xxx.xx, server: mywebsite.com, request: &quot;GET /phpMyAdmin/ HTTP/1.1&quot;, upstream: &quot;fastcgi://127.0.0.1:9000&quot;, host: &quot;mywebsite.com&quot;
  
  2021/05/01 17:23:09 [error] 15816#15816: *103 open() &quot;/var/www/html/favicon.ico&quot; failed (2: No such file or directory), client: 125.xxx.xxx.xx, server: mywebsite.com, request: &quot;GET /favicon.ico HTTP/1.1&quot;, host: &quot;mywebsite.com&quot;
  </code></pre>
  <p>Here is my nginx.conf</p>
  <pre><code>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;
  
  server {
      listen  443 ssl;
      server_name     mywebiste.com;
  
  
      root /var/www/html;
  
  location / {
  index index.php index.html index.htm;
  }
  
  location ^~ /blog {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_pass http://127.0.0.1:2368;
    }
  
  location ~ \.php$ {
  fastcgi_pass unix:/var/run/php-fpm.sock;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;
  }
  }
  </code></pre>
  <p>And here is my /etc/nginx/conf.d/default.conf
  server {</p>
  <pre><code>    location /phpMyAdmin {
          alias /usr/share/phpMyAdmin/;
          try_files $uri $uri/ /index.php;
  
          location ~ ^/phpMyAdmin/(.+\.php)$ {
              alias /usr/share/phpMyAdmin;
              fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
              fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin/$1;
              include fastcgi_params;
              fastcgi_intercept_errors on;
              allow XXX.XXX.XX.XX;  # 
              deny  all;            # 
          }
      }     
  
  }
  </code></pre>
  <blockquote>
  <p>UPDATE(I did Dear qwsj answer,after that Here is my update.)</p>
  </blockquote>
  <p>I installed  phpmyadmin at /usr/share/phpMyAdmin</p>
  <p>ln -s /usr/share/phpMyAdmin /var/www/html/mywebisite/phpmyadmin</p>
  <p>I open https://mywebisite/phpmyadmin/</p>
  <p>error log says
  directory index of &quot;/var/www/html/mywebisite/phpmyadmin/&quot; is forbidden,</p>