Created
December 10, 2020 09:24
-
-
Save amanjuman/595ba5ec6494a03e8b0544986cafb092 to your computer and use it in GitHub Desktop.
PHPMyAdmin Nginx Configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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