Sfoglia il codice sorgente

phpmyadmin is working

Bachir Soussi Chiadmi 5 anni fa
parent
commit
81a0dff38c
2 ha cambiato i file con 86 aggiunte e 40 eliminazioni
  1. 42 1
      assets/lemp/default.nginxconf
  2. 44 39
      bin/lemp.sh

+ 42 - 1
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;

+ 44 - 39
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
-
-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/
+echo -e "Installing phpMyAdmin"
+apk add phpmyadmin php7-mysqli
+service php-fpm7 restart
 
-rc-update add nginx
-service nginx start
-echo -e "Nginx installed"
+chmod +r /etc/phpmyadmin/config.inc.php
 
-# 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"