Skip to content

Instantly share code, notes, and snippets.

@matthieuauger
Created February 15, 2014 12:14
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieuauger/9018551 to your computer and use it in GitHub Desktop.
Save matthieuauger/9018551 to your computer and use it in GitHub Desktop.
Nginx & PHP-FPM configuration for phpMyAdmin
server {
listen 80;
server_name phpmyadmin.yourdomain.com;
access_log /var/log/nginx/phpmyadmin_access.log;
error_log /var/log/nginx/phpmyadmin_error.log;
root /usr/share/phpmyadmin;
index index.php;
location / {
try_files $uri $uri/ @phpmyadmin;
}
location @phpmyadmin {
fastcgi_pass unix:/var/run/php5-fpm.sock;
# If nginx running on TCP socket, comment line above and uncomment line beneath
#fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/index.php;
fastcgi_param SCRIPT_NAME /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
# If nginx running on TCP socket, comment line above and uncomment line beneath
#fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;
}
}
@oquidave
Copy link

I had to modify mine as follows for it to work;
`server {
listen 80;
server_name phpmyadmin.yourdomain.com;

access_log /var/log/nginx/phpmyadmin_access.log;
error_log /var/log/nginx/phpmyadmin_error.log;

root   /usr/share/phpmyadmin;
index  index.php;

location / {
    try_files $uri $uri/ @phpmyadmin;
}

location @phpmyadmin {
    include snippets/fastcgi-php.conf;
    fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/index.php;
    fastcgi_param SCRIPT_NAME /index.php;
}

location ~ \.php$ {
    fastcgi_pass   unix:/run/php/php7.1-fpm.sock;
    # If nginx running on TCP socket, comment line above and uncomment line beneath
    #fastcgi_pass    127.0.0.1:9000;
    include snippets/fastcgi-php.conf;
    fastcgi_param  SCRIPT_FILENAME  /usr/share/phpmyadmin$fastcgi_script_name;
}   

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment