Skip to content

Instantly share code, notes, and snippets.

@mdrmike
Last active January 12, 2022 21:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdrmike/8cd55112af1db7a446f5 to your computer and use it in GitHub Desktop.
Save mdrmike/8cd55112af1db7a446f5 to your computer and use it in GitHub Desktop.
NGINX vhost file for phpmyadmin on ubuntu 14.04 using sudo-apt get install phpmyadmin ,,, install as normal but don't select webserver (neither apache nor lighttpd). add this to /etc/nginx/sites-available/ then enable by adding to sites-enabled and add 127.0.0.1 phpmyadmin to /etc/hosts
server {
listen 80;
server_name phpmyadmin;
root /usr/share/phpmyadmin/;
index index.php index.html;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS!
location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
deny all;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ {
expires max;
log_not_found off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment