Last active
December 12, 2015 07:48
-
-
Save setola/4738802 to your computer and use it in GitHub Desktop.
PHPMyAdmin safe config on Ubuntu Server
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
<Directory /usr/share/phpmyadmin> | |
Order allow,deny | |
Allow from 192.168.1.0/24 | |
</Directory> |
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
# phpMyAdmin default Apache configuration | |
<VirtualHost *:80> | |
ServerAdmin [email protected] | |
ServerName pma1.mydomain.ltd | |
DocumentRoot /usr/share/phpmyadmin | |
<Directory /usr/share/phpmyadmin> | |
Options FollowSymLinks | |
DirectoryIndex index.php | |
AuthType Basic | |
AuthName "RESTRICTED ACCESS" | |
AuthUserFile /srv/www/.htpasswd | |
Require user myusername | |
<IfModule mod_php5.c> | |
AddType application/x-httpd-php .php | |
php_flag magic_quotes_gpc Off | |
php_flag track_vars On | |
php_flag register_globals Off | |
php_admin_flag allow_url_fopen Off | |
php_value include_path . | |
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp | |
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/ | |
</IfModule> | |
</Directory> | |
# Disallow web access to setup | |
<Directory /usr/share/phpmyadmin/setup> | |
Order Deny,Allow | |
Deny from All | |
</Directory> | |
# Disallow web access to libraries | |
<Directory /usr/share/phpmyadmin/libraries> | |
Order Deny,Allow | |
Deny from All | |
</Directory> | |
</VirtualHost> |
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
<VirtualHost *:80> | |
SSLEngine on | |
SSLOptions +StrictRequire | |
SSLCertificateFile /etc/ssl/certs/server.crt | |
SSLCertificateKeyFile /etc/ssl/private/server.key | |
RewriteEngine On | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment