Skip to content

Instantly share code, notes, and snippets.

@64lines
Created June 27, 2017 14:20
Show Gist options
  • Select an option

  • Save 64lines/ca7d98542f4a51184dd41bfc4687822b to your computer and use it in GitHub Desktop.

Select an option

Save 64lines/ca7d98542f4a51184dd41bfc4687822b to your computer and use it in GitHub Desktop.
[BASH] Nginx install and configuration
echo "*** Installing nginx packages... ***"
apt-get install -y nginx-core
mkdir /var/www/
echo "*** Setting stuff up... ***"
STATIC_NGINX_CONF="/etc/nginx/conf.d/static.conf"
echo "<h1>This is a static content server with nginx</h1>" >> /var/www/index.html
echo "server {" > $STATIC_NGINX_CONF
echo " listen 80;" >> $STATIC_NGINX_CONF
echo " location / {" >> $STATIC_NGINX_CONF
echo " root /var/www/;" >> $STATIC_NGINX_CONF
echo " index index.html;" >> $STATIC_NGINX_CONF
echo " }" >> $STATIC_NGINX_CONF
echo "}" >> $STATIC_NGINX_CONF
rm /etc/nginx/sites-enabled/default
nginx -s reload
echo "cd /cookbooks" >> .bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment