R
R
Roman Andreevich2020-02-02 15:42:12
PHP
Roman Andreevich, 2020-02-02 15:42:12

How to set up phpmyadmin + nginx?

Colleagues, I ask for help, I can’t set up phpmyadmin in any way. Instead of opening phpmyadmin in a browser, a php file is downloaded. Please tell me how to set it up, here is the site config for everyone:

server {
  listen 80 default_server;
  listen [::]:80 default_server;

  root /var/www/html;

  index index.php;

  server_name _;

  location / {
    try_files $uri $uri/ =404;
  }
  
  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
  
    # With php-fpm (or other unix sockets):
    #fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    # With php-cgi (or other tcp sockets):
    #fastcgi_pass 127.0.0.1:9000;
  }
}


Here is the nginx config:

user www-data;
pid /run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 65535;

events {
  multi_accept on;
  worker_connections 65535;
}

http {
  charset utf-8;
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  server_tokens off;
  types_hash_max_size 2048;
  client_max_body_size 16M;

  # MIME
  include mime.types;
  default_type application/octet-stream;

  # logging
  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log warn;

  # load configs
  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;
}


Console output:

PHP 7.2.24-0ubuntu0.18.04.2 (fpm-fcgi) (built: Jan 13 2020 18:39:59)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.24-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies

PHP 7.2.24-0ubuntu0.18.04.2 (cli) (built: Jan 13 2020 18:39:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.24-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Page-Audit.ru, 2020-02-02
@PageAuditRU

I have it set up like this a hundred years ago, it works.

server {
  listen 8379;
  server_name _;
  root /usr/share/phpMyAdmin-4.9.4;
  index index.php;

  access_log off;
  error_log /var/log/nginx/phpmyadmin.error.log;

  location ~ ^/(.+\.php)$ {
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }

}

It opens through its own port mysite.com:8379
In your version, the directory where the PHPMyadmin script is located is not specified and it is not specified who should execute it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question