From 81a0dff38c123a3f709cb5ce04159559af36c3e8 Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Sat, 20 Apr 2019 11:16:27 +0200 Subject: [PATCH] phpmyadmin is working --- assets/lemp/default.nginxconf | 43 +++++++++++++++++- bin/lemp.sh | 83 +++++++++++++++++++---------------- 2 files changed, 86 insertions(+), 40 deletions(-) diff --git a/assets/lemp/default.nginxconf b/assets/lemp/default.nginxconf index 6ec0f8e..f541414 100644 --- a/assets/lemp/default.nginxconf +++ b/assets/lemp/default.nginxconf @@ -21,7 +21,7 @@ server { root /var/www/html; # Add index.php to the list if you are using PHP - index index.html index.htm index.nginx-debian.html index.php; + index index.html index.htm index.php; server_name _; @@ -31,6 +31,47 @@ server { try_files $uri $uri/ =404; } + location /phpmyadmin { + root /usr/share/webapps/; + + # Deny static files + location ~ ^/phpMyAdmin/(README|LICENSE|ChangeLog|DCO)$ { + deny all; + } + + # Deny .md files + location ~ ^/phpMyAdmin/(.+\.md)$ { + deny all; + } + + # Deny setup directories + location ~ ^/phpMyAdmin/(doc|sql|setup)/ { + deny all; + } + + location ~ ^/phpmyadmin/(.+\.php)$ { + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + include fastcgi.conf; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + try_files $uri $document_root$fastcgi_script_name =404; + + fastcgi_split_path_info ^(.+\.php)(/.*)$; + fastcgi_param PATH_INFO $fastcgi_path_info; + + fastcgi_param HTTP_PROXY ""; + fastcgi_param HTTPS on; + fastcgi_request_buffering off; + } + + location ~ ^/phpmyadmin/(.*\.(eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|xls|tar|bmp))$ { + root /usr/share/webapps/; + expires 30d; + log_not_found off; + access_log off; + } + } + # pass PHP scripts to FastCGI server location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; diff --git a/bin/lemp.sh b/bin/lemp.sh index d275bbb..9c1e735 100755 --- a/bin/lemp.sh +++ b/bin/lemp.sh @@ -91,51 +91,31 @@ service php-fpm7 start echo -e "php installed" echo -e ' - _ - _ _ __ _(_)_ _ __ __ - | ` \/ _` | | ` \\ \ / - |_||_\__, |_|_||_/_\_\ - |___/ + _ __ __ _ _ _ + _ __| |_ _ __| \/ |_ _ /_\ __| |_ __ (_)_ _ + | `_ \ ` \| `_ \ |\/| | || |/ _ \/ _` | ` \| | ` \ + | .__/_||_| .__/_| |_|\_, /_/ \_\__,_|_|_|_|_|_||_| + |_| |_| |__/ ' -echo -e "Installing Nginx" -sleep 3 -apk add nginx +echo -e "Installing phpMyAdmin" +apk add phpmyadmin php7-mysqli +service php-fpm7 restart -adduser -D -g 'www' www -mkdir -p /var/www/html -chown -R www:www /var/lib/nginx -chown -R www:www /var/www/html +chmod +r /etc/phpmyadmin/config.inc.php -mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.ori -cp "$_assets"/lemp/default.nginxconf /etc/nginx/conf.d/default.conf -cp "$_assets"/lemp/index.php /var/www/html/ - -rc-update add nginx -service nginx start -echo -e "Nginx installed" - -# echo -e ' -# _ __ __ _ _ _ -# _ __| |_ _ __| \/ |_ _ /_\ __| |_ __ (_)_ _ -# | `_ \ ` \| `_ \ |\/| | || |/ _ \/ _` | ` \| | ` \ -# | .__/_||_| .__/_| |_|\_, /_/ \_\__,_|_|_|_|_|_||_| -# |_| |_| |__/ -# ' -# echo -e "Installing phpMyAdmin" -# apk add phpmyadmin # ln -s /usr/share/phpmyadmin /var/www/html/ # cp "$_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 -e "securing phpMyAdmin" -# # sed -i "s/DirectoryIndex index.php/DirectoryIndex index.php\nAllowOverride all/" -# # cp "$_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 -e "phpMyAdmin installed" -# echo -e "You can access it at yourip/phpmyadmin" + +# echo -e "securing phpMyAdmin" +# sed -i "s/DirectoryIndex index.php/DirectoryIndex index.php\nAllowOverride all/" +# cp "$_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 -e "phpMyAdmin installed" +echo -e "You can access it at yourip/phpmyadmin" echo -e ' _ _ @@ -184,3 +164,28 @@ 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 -e "Drush and DrupalConsoleinstalled" + + +echo -e ' + _ + _ _ __ _(_)_ _ __ __ + | ` \/ _` | | ` \\ \ / + |_||_\__, |_|_||_/_\_\ + |___/ +' +echo -e "Installing Nginx" +sleep 3 +apk add nginx + +adduser -D -g 'www' www +mkdir -p /var/www/html +chown -R www:www /var/lib/nginx +chown -R www:www /var/www/html + +mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.ori +cp "$_assets"/lemp/default.nginxconf /etc/nginx/conf.d/default.conf +cp "$_assets"/lemp/index.php /var/www/html/ + +rc-update add nginx +service nginx start +echo -e "Nginx installed"