Last active
December 30, 2024 13:42
-
-
Save amanjuman/dc973eedf346b69727f0ae45191939fa to your computer and use it in GitHub Desktop.
Nginx PHPmyAdmin Subdomain
This file contains 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
sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php | |
## Search Clt + W | |
(count($analyzed_sql_results['select_expr'] == 1) | |
## Replace | |
((count($analyzed_sql_results['select_expr']) == 1) | |
## Add Bottom | |
$cfg['SendErrorReports'] = 'never'; | |
## Change this | |
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root-password'; | |
sudo nano /etc/nginx/conf.d/phpmyadmin.conf | |
# phpMyAdmin subdomain | |
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