在nginx上使用php7-fpm“没有指定输入文件”

时间:2017-12-12 20:43:59

标签: nginx phpmyadmin php-7 fpm

我是nginx的新手,并在上面安装了phpmyadmin。我正在使用Debian弹性发行版。我尝试访问no input file specified时遇到的/phpmyadmin错误在StackOverflow上反复出现,但它们似乎都是较旧的帖子。试图将网络上许多不同建议的正确配置拼凑起来一直是个噩梦。我尝试了一些提到的解决方案,但没有一个对我有效。这是我的完整配置文件:

server {
  gzip on;
  gzip_types text/plain text/html text/css application/javascript;

  root /home/me/projects/MyApp/public;
  location / {
      try_files $uri @proxy;
      expires max;
  }
  location @proxy {
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://localhost:5000;

  }

  location /phpmyadmin {
    alias /usr/share/nginx/html/phpmyadmin;
    index index.php index.html;
      include snippets/fastcgi-php.conf;
      fastcgi_pass unix:/run/php/php7.0-fpm.sock;
      location ~ /\.ht {
        deny all;
      }
  }
}

1 个答案:

答案 0 :(得分:1)

好的,这是我的配置文件中至少可以使用phpmyadmin工作的部分(我不能保证它是安全的):

  location /phpmyadmin/ {
    alias /usr/share/nginx/html/phpmyadmin/;
    index index.php index.html;

    location ~* \.php$ {
      include /etc/nginx/fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $request_filename;
      fastcgi_pass unix:/run/php/php7.0-fpm.sock;
      location ~ /\.ht {
        deny all;
      }
    }

我还必须在我的php.ini文件中注释掉一行,根据一些在线教程的建议,我已经取消注释:

cgi.fix_pathinfo=0

;cgi.fix_pathinfo=0
相关问题