added nginx-phpmyadmin.conf

This commit is contained in:
Bachir Soussi Chiadmi 2018-04-06 10:51:11 +02:00
parent e1a7b811e2
commit 8f21321eaf
4 changed files with 81 additions and 15 deletions

View File

@ -106,8 +106,8 @@ server {
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
try_files $uri @rewrite;
expires max;
log_not_found off;
}
}

View File

@ -0,0 +1,33 @@
server {
listen 80;
location /phpmyadmin {
# server_name phpmyadmin.idroot.net;
root /usr/share/phpmyadmin;
location / {
index index.php;
}
## Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 30d;
}
location ~ /\.ht {
deny all;
}
location ~ /(libraries|setup/frames|setup/libs) {
deny all;
return 404;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
}

View File

@ -1,10 +1,10 @@
server {
listen 80;
server_name yourdomain.ltd;
root /var/www/yourdomain.ltd/public_html;
index index.html index.php;
server_name yourdomain.ltd;
charset utf-8;
location / {

View File

@ -45,7 +45,7 @@ echo '\033[35m
/_/ /_/_/____/\___/
\033[0m'
apt-get --yes --force-yes install vim
apt-get --yes --force-yes install vim curl
sed -i "s/^# en_GB.UTF-8/en_GB.UTF-8/g" /etc/locale.gen
locale-gen
apt-get --yes --force-yes install ntp
@ -355,20 +355,19 @@ if [ "$lemp" = "y" ]; then
\033[0m'
echo "\033[35;1mInstalling phpMyAdmin \033[0m"
apt-get --yes --force-yes install phpmyadmin
# echo "include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
# ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
# a2enconf phpmyadmin.conf
cp "$_cwd"/assets/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf
ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf
echo "\033[35;1msecuring phpMyAdmin \033[0m"
# sed -i "s/DirectoryIndex index.php/DirectoryIndex index.php\nAllowOverride all/"
cp "$_cwd"/assets/phpmyadmin_htaccess > /usr/share/phpmyadmin/.htaccess
echo -n "define a user name for phpmyadmin : "
read un
htpasswd -c /etc/phpmyadmin/.htpasswd $un
# cp "$_cwd"/assets/phpmyadmin_htaccess > /usr/share/phpmyadmin/.htaccess
# echo -n "define a user name for phpmyadmin : "
# read un
# htpasswd -c /etc/phpmyadmin/.htpasswd $un
# service apache2 restart
echo "\033[92;1mphpMyAdmin installed\033[Om"
echo "\033[92;1mYou can access it at yourip/phpmyadmin\033[Om"
echo '\033[35m
____ ___
/ __ \___ ____/ (_)____
@ -384,6 +383,38 @@ if [ "$lemp" = "y" ]; then
systemctl restart redis-server
echo "\033[92;1mRedis installed\033[Om"
echo '\033[35m
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
\033[0m'
echo "\033[35;1mInstalling Composer \033[0m"
sleep 3
export COMPOSER_HOME=/usr/local/composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
echo "\033[92;1mComposer installed\033[Om"
echo '\033[35m
____ __
/ __ \_______ _______/ /_
/ / / / ___/ / / / ___/ __ \
/ /_/ / / / /_/ (__ ) / / /
/_____/_/ \__,_/____/_/ /_/
\033[0m'
echo "\033[35;1mInstalling Drush and DrupalConsole\033[0m"
sleep 3
curl https://drupalconsole.com/installer -L -o /usr/local/bin/drupal
chmod +x /usr/local/bin/drupal
curl https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar -L -o /usr/local/bin/drush
chmod +x /usr/local/bin/drush
echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om"
echo '\033[35m
__ __
_ __/ /_ ____ _____/ /_
@ -429,9 +460,11 @@ if [ "$lemp" = "y" ]; then
ln -s /var/www/"$_host_name" /home/"$user"/www/"$_host_name"
# activate the vhost
# a2ensite "$_host_name".conf
ln -s /etc/nginx/sites-available/"$_host_name".conf /etc/nginx/sites-enabled/"$_host_name".conf
# TODO : lets'encrypt
# https://certbot.eff.org/lets-encrypt/debianstretch-nginx
# restart nginx
systemctl restart nginx
echo "\033[92;1mvhost $_host_name configured\033[Om"