Last active
October 20, 2023 08:03
-
-
Save jniltinho/9af397c8ddb035a322b75aecce7cdeae to your computer and use it in GitHub Desktop.
Install phpMyAdmin on ISPConfig
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
#!/bin/bash | |
## Install phpMyAdmin on ISPConfig | |
## Debian 9 or Ubuntu (Apache2 and Nginx) | |
## phpMyAdmin 4.8.3 | |
cd /tmp/ | |
get_file=https://files.phpmyadmin.net/phpMyAdmin/4.8.3/phpMyAdmin-4.8.3-all-languages.tar.gz | |
wget ${get_file} | |
tar -xzvf $(basename ${get_file}) | |
rm -f $(basename ${get_file}) && mv phpMyAdmin-*-all-languages myadmin | |
if [ -d "/usr/local/ispconfig/interface/web/myadmin" ]; then rm -rf /usr/local/ispconfig/interface/web/myadmin; fi | |
echo '<?php | |
$cfg['blowfish_secret'] = "BLOWFISHSECRET"; | |
$i = 0; | |
$i++; | |
$cfg["Servers"][$i]["auth_type"] = "cookie"; | |
$cfg["Servers"][$i]["host"] = "localhost"; | |
$cfg["Servers"][$i]["connect_type"] = "tcp"; | |
$cfg["Servers"][$i]["compress"] = false; | |
$cfg["Servers"][$i]["AllowNoPassword"] = false; | |
$cfg["Servers"][$i]["extension"] = "mysqli"; | |
$cfg["UploadDir"] = ""; | |
$cfg["SaveDir"] = ""; | |
if ($_SERVER["SERVER_PORT"] != 81){$cfg["Servers"][$i]["AllowRoot"] = FALSE; | |
$cfg["Servers"][$i]["hide_db"] = "(information_schema|phpmyadmin|mysql|test)"; | |
} | |
$cfg["Lang"] = "en";' > myadmin/config.inc.php | |
blowfish_secret=$(openssl rand -base64 32) | |
sed -i "s|BLOWFISHSECRET|$blowfish_secret|" myadmin/config.inc.php | |
## For Nginx Env | |
if [ -d "/etc/nginx" ]; then | |
echo 'location /phpmyadmin { | |
root /usr/share/; | |
index index.php index.html index.htm; | |
location ~ ^/phpmyadmin/(.+\.php)$ { | |
try_files $uri =404; | |
root /usr/share/; | |
fastcgi_pass unix:/var/run/FMP_SOCK; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $request_filename; | |
include /etc/nginx/fastcgi_params; | |
fastcgi_param PATH_INFO $fastcgi_script_name; | |
fastcgi_buffer_size 128k; | |
fastcgi_buffers 256 4k; | |
fastcgi_busy_buffers_size 256k; | |
fastcgi_temp_file_write_size 256k; | |
fastcgi_intercept_errors on; | |
} | |
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { | |
root /usr/share/; | |
} | |
} | |
location /phpMyAdmin { | |
rewrite ^/* /phpmyadmin last; | |
}' > /etc/nginx/phpmyadmin.conf | |
if [ -S "/var/run/php/php7.0-fpm.sock" ]; then sed -i "s|FMP_SOCK|php/php7.0-fpm.sock|" /etc/nginx/phpmyadmin.conf; fi | |
if [ -S "/var/run/php5-fpm.sock" ]; then sed -i "s|FMP_SOCK|php5-fpm.sock|" /etc/nginx/phpmyadmin.conf; fi | |
cp -aR myadmin /usr/share/phpmyadmin | |
chown -R ispconfig:ispconfig myadmin | |
cp -aR myadmin /usr/local/ispconfig/interface/web/ | |
## For Nginx , Include in site | |
## include /etc/nginx/phpmyadmin.conf; | |
fi | |
## For Apache2 Env | |
if [ -d "/etc/apache2" ]; then | |
cd /tmp/ | |
chown -R ispconfig:ispconfig myadmin | |
cp -aR myadmin /usr/local/ispconfig/interface/web/ | |
wget https://raw.githubusercontent.com/jniltinho/ispconfig/master/files/server/conf-custom/apache_ispconfig.conf.master | |
mv apache_ispconfig.conf.master /usr/local/ispconfig/server/conf-custom/ | |
mkdir -p /var/www/htdocs | |
cd /var/www/htdocs/ | |
wget https://raw.githubusercontent.com/jniltinho/ispconfig/master/files/htdocs/index.html | |
wget https://raw.githubusercontent.com/jniltinho/ispconfig/master/files/htdocs/under_construction.png | |
wget https://raw.githubusercontent.com/jniltinho/ispconfig/master/files/htdocs/under_construction1.png | |
wget https://raw.githubusercontent.com/jniltinho/ispconfig/master/files/htdocs/under_construction2.png | |
wget https://raw.githubusercontent.com/jniltinho/ispconfig/master/files/htdocs/favicon.ico | |
chown -R www-data:www-data /var/www/htdocs | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment