title: Make phpMyAdmin work as alias in Nginx + PHP-FPM
body: <p>The system is Fedora 25, with Nginx 1.10.2 and PHP 7.0.14 work in CGI Mode.</p>
  
  <p>I using dnf to install phpMyAdmin, the location is <strong>/usr/share/phpMyAdmin</strong>, so I try to let it work as alias in multi-website.</p>
  
  <pre><code>location /phpmyadmin {
      alias /usr/share/phpMyAdmin;
      include fastcgi_php.conf;
  }
  </code></pre>
  
  <p>And I add the location into open_basedir.</p>
  
  <pre><code>fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/usr/share/phpMyAdmin/:/var/lib/phpMyAdmin/:/etc/phpMyAdmin/:/usr/share/php:/usr/bin/pear:/dev/null:/var/lib/php";
  </code></pre>
  
  <p>I open the URL and the log show this message:</p>
  
  <pre><code>2016/12/19 17:52:05 [error] 2241#0: *2 FastCGI sent in stderr: "Unable to open primary script: /usr/share/phpMyAdmin/phpmyadmin/index.php (No such file or directory)" while reading response header from upstream, client: 1.1.1.1, server:1.1.1.1 , request: "GET /phpmyadmin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:"
  </code></pre>
  
  <p>How to make it correct and work? Thank you!</p>
  
  <p>Update:</p>
  
  <p>I think maybe cause by <strong>fastcgi_param</strong>, in order to solve the blank page problem in PHP fastcgi, I add 2 line into this file.</p>
  
  <pre><code>fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_script_name;
  </code></pre>
  
  <p><strong>nginx.conf:</strong></p>
  
  <pre><code>user nginx nginx;
  worker_processes 2;
  pid /run/nginx.pid;
  
  include /etc/nginx/modules-enabled/*.conf;
  
  events {
      use epoll;
      worker_connections 2048;
      multi_accept on;
  }
  
  http {
      log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';
      access_log  /var/log/nginx/access.log  main;
      error_log /var/log/nginx/error.log;
      include /etc/nginx/mime.types;
      default_type application/octet-stream;
      geoip_country /usr/share/GeoIP/GeoIP.dat;
  
      charset UTF-8;
      sendfile on;
      send_timeout 10;
      tcp_nopush on;
      tcp_nodelay on;
      keepalive_timeout 30;
      server_tokens off;
      client_header_timeout 10;
      client_max_body_size 64M;
      client_body_timeout 10;
      client_body_buffer_size 256k;
      open_file_cache max=102400 inactive=20s;
      open_file_cache_valid 30s;
      open_file_cache_min_uses 5;
      open_file_cache_errors off;
      types_hash_max_size 4096;
      reset_timedout_connection on;
      fastcgi_buffers 16 32k;
      fastcgi_buffer_size 32k;
      fastcgi_intercept_errors on;
      gzip on;
      gzip_disable "msie6";
      gzip_vary on;
      gzip_proxied any;
      gzip_min_length 1024;
      gzip_comp_level 6;
      gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  
      include /etc/nginx/conf.d/*.conf;
      include /etc/nginx/sites-enabled/*;
  }
  </code></pre>
  
  <p><strong>fastcgi_php.conf:</strong></p>
  
  <pre><code>location ~ \.php$ {
      fastcgi_split_path_info ^(.+?\.php)(/.*)?$;
      fastcgi_pass unix:/var/run/php5-fpm.sock;
      fastcgi_index index.php;
      include fastcgi_params;
  }
  </code></pre>
  
  <p><strong>website.conf:</strong></p>
  
  <pre><code>server {
  listen 443 ssl;
  server_name test.domain.com;
  root /var/www/site1;
  index index.html index.php;
  access_log /var/log/site1-access.log combined;
  error_log /var/log/site1-error.log warn;
  ssl_certificate /etc/nginx/ssl/xxx.crt;
  ssl_certificate_key /etc/nginx/ssl/xxx.key;
  ssl_dhparam /etc/nginx/ssl/dhparams.pem;
  ssl_session_cache shared:SSL:10m;
  ssl_session_timeout 10m;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
  ssl_prefer_server_ciphers on;
  add_header Strict-Transport-Security "max-age=31536000";
  add_header X-Content-Type-Options nosniff;
  
  location / {
      try_files $uri $uri/ /error.html;
      include fastcgi_php.conf;
  }
  
  location /phpmyadmin {
      alias /usr/share/phpMyAdmin;
      include fastcgi_php.conf;
  }
  
  location = /robots.txt {
      allow all;
      log_not_found off;
      access_log off;
  }
  
  location ~ /\. {
      deny all;
  }
  </code></pre>
  
  <p>}</p>