Please review the following Bash script that uses to establish a "lightweight" Ubuntu-Nginx server environment mainly aimed to run small WordPress sites (about 5 plugins, about 25 webpages, about 25 images) on a cloud hosting platform.
The BASHRC
heredocument sets aliases for personal scripts I already have and might use me later on.
apt-get update -y && apt-get upgrade -y && add-apt-repository ppa:certbot/certbot -y
ufw enable && ufw allow 22/tcp 80/tcp 443/tcp 9000/tcp && ufw allow 53/upd
apt-get install zip unzip tree unattended-upgrades sshguard postfix nginx python-certbot-nginx mysql-server php-fpm php-mysql php-mbstring php-mcrypt -y
sed -i "s/# gzip_/gzip_/g" /etc/nginx/nginx.conf
sed -i "s/max_size = .M/max_size = 200M/g" /etc/php/*/fpm/php.ini
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php/*/fpm/php.ini
/etc/init.d/php*-fpm restart && systemctl restart nginx.service
cat <<-"BASHRC" >> /etc/bash.bashrc
alias rss="/etc/init.d/php*-fpm restart && systemctl restart nginx.service"
alias brc="nano /etc/bash.bashrc"
alias www="cd /var/www/html"
alias pma="tmux new-session -d 'bash ~/scripts/pma.sh"
alias imb="bash ~/scripts/imb.sh"
BASHRC
source /etc/bash.bashrc
/etc/bash.bashrc
. Unless you do something beyond what you've pasted in there's no point insource
ing anything right before you exit. You could do yoursource
in your interactive session to get the aliases sooner. \$\endgroup\$ – chicks Jan 12 '18 at 23:41source
action - I totally missed your point. Will you please rephrase it? @chicks \$\endgroup\$ – Arcticooling Jan 13 '18 at 5:46