Skip to content

Instantly share code, notes, and snippets.

@ehnydeel
Created February 6, 2014 15:24
Show Gist options
  • Save ehnydeel/9e40a8fb75dd12d17547 to your computer and use it in GitHub Desktop.
Save ehnydeel/9e40a8fb75dd12d17547 to your computer and use it in GitHub Desktop.
Nginx Config-Script with phpmyadmin
server {
listen 80;
# <directory> have to be changed
root /var/www/<directory>/public_html;
index index.php index.html index.htm;
# <server_name> have to be changed
server_name <server_name>;
location / {
try_files $uri $uri/ /index.html;
}
#-----------------------------
# PHPMYADMIN |
#-----------------------------
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
#----------------------------
# END PHPMYADMIN |
#----------------------------
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment