Skip to content

Instantly share code, notes, and snippets.

@amanjuman
Created December 10, 2020 09:24
Show Gist options
  • Save amanjuman/595ba5ec6494a03e8b0544986cafb092 to your computer and use it in GitHub Desktop.
Save amanjuman/595ba5ec6494a03e8b0544986cafb092 to your computer and use it in GitHub Desktop.
PHPMyAdmin Nginx Configuration
server
{
# Port Listen
listen 80;
listen [::]:80;
#listen 443 ssl http2;
#listen [::]:443 ssl http2;
# Root Dir
root /usr/share/phpmyadmin;
index index.php index.html index.htm;
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
# Server Name
server_name subdomain.domain.tld;
# SSL File Locations
#ssl_certificate /etc/letsencrypt/live/subdomain.domain.tld/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/subdomain.domain.tld/privkey.pem;
#ssl_trusted_certificate /etc/letsencrypt/live/subdomain.domain.tld/fullchain.pem;
# HTTP to HTTPS redirection
#if ($scheme != "https")
#{
# return 301 https://$host$request_uri;
#}
# Enable Basic Auth
location /
{
try_files $uri $uri/ =404;
#auth_basic "Restricted Access";
#auth_basic_user_file /etc/nginx/.htpasswd;
}
# Error Page Reply
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
# Error Page Location
location = /50x.html
{
root /usr/share/nginx/html;
}
# PHP Configuration
location ~ \.php$
{
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
}
# Prevent SQL Injection
location ~ ^/(doc|sql|setup)/
{
deny all;
}
# Disable Hidden FIle Access Except Lets Encrypt Verification
location ~ /\.well-known
{
allow all;
}
# Logs Files
access_log /var/log/nginx/subdomain.domain.tld-access.log;
error_log /var/log/nginx/subdomain.domain.tld-error.log warn;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment