#!/bin/bash #################################################################################################### #### author: SlickStack ############################################################################ #### link: https://slickstack.io ################################################################### #### mirror: http://mirrors.slickstack.io/bash/ss-install-nginx.txt ################################ #### path: /var/www/ss-install-nginx ############################################################### #### destination: n/a (not a boilerplate) ########################################################## #### purpose: Reinstalls the entire Nginx module for SlickStack servers (idempotent) ############### #### module version: Nginx 1.18.x ################################################################## #### sourced by: ss-install ######################################################################## #### bash aliases: ss install nginx ################################################################ #################################################################################################### ## SS-CONFIG MUST BE PROPERLY CONFIGURED AND ON CURRENT BUILD BEFORE RUNNING SS-INSTALL ## ## ENSURE YOUR SS-CONFIG BUILD REMAINS CURRENT BY RUNNING SS-UPDATE OCCASIONALLY ## ## source ss-config ## source /var/www/ss-config ## source ss-functions ## source /var/www/ss-functions ## BELOW THIS RELIES ON SS-CONFIG AND SS-FUNCTIONS ## #################################################################################################### #### SS-Install-Nginx: Message (Begin Script) ###################################################### #################################################################################################### ## this is a simple message that announces to the shell the purpose of this bash script ## ## it will only be noticed by sudo users who manually call ss core bash scripts ## ## echo message ## echo -e "${PURPLE}Running ss-install-nginx: Reinstalls the entire Nginx module for SlickStack servers (idempotent)... ${NOCOLOR}" sleep "$SLEEP_MESSAGE_BEGIN" #################################################################################################### #### SS-Install-Nginx: Backup Database Before Proceeding ########################################### #################################################################################################### ## run ss-dump-database ## source "$PATH_SS_DUMP_DATABASE" #################################################################################################### #### SS-Install-Nginx: Install Nginx Core ########################################################## #################################################################################################### ## run ss-install-nginx-core ## source "$PATH_SS_INSTALL_NGINX_CORE" #################################################################################################### #### SS-Install-Nginx: Install Nginx Config Files ################################################## #################################################################################################### ## run ss-install-nginx-config ## source "$PATH_SS_INSTALL_NGINX_CONFIG" ## run ss-install-nginx-ssl (included in ss-install-nginx-config) ## # source "$PATH_SS_INSTALL_NGINX_SSL" #################################################################################################### #### SS-Install-Nginx: Touch Timestamp File ######################################################## #################################################################################################### ## this is a dummy timestamp file that will remember the last time this script was run ## ## it can be useful for developer reference and is sometimes used by SlickStack ## ## script timestamp ## touch "$TIMESTAMP_SS_INSTALL_NGINX" #################################################################################################### #### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ############### #################################################################################################### ## Ref: https://serverfault.com/questions/527630/difference-in-sites-available-vs-sites-enabled-vs-conf-d-directories-nginx ## Ref: https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04 ## Ref: https://ar.al/2018/07/05/nginx-remember-to-remove-the-default-site/ ## Ref: https://discourse.roots.io/t/http-does-not-redirect-to-https-only-at-the-first-access/8669 ## SS_EOF