diff --git a/assets/nginx-drupal.conf b/assets/nginx-drupal.conf index 0314bff..bfeead8 100644 --- a/assets/nginx-drupal.conf +++ b/assets/nginx-drupal.conf @@ -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; } } diff --git a/assets/nginx-phpmyadmin.conf b/assets/nginx-phpmyadmin.conf new file mode 100644 index 0000000..7528a0f --- /dev/null +++ b/assets/nginx-phpmyadmin.conf @@ -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; + } + } +} diff --git a/assets/nginx.conf b/assets/nginx.conf index 426b20b..ec10d9b 100644 --- a/assets/nginx.conf +++ b/assets/nginx.conf @@ -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 / { diff --git a/install-debian-server.sh b/install-debian-server.sh index 59b5800..a4dae9b 100755 --- a/install-debian-server.sh +++ b/install-debian-server.sh @@ -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"