diff --git a/one-time-stuff/install-software.sh b/one-time-stuff/install-software.sh index 5671b24..ed6b1e2 100755 --- a/one-time-stuff/install-software.sh +++ b/one-time-stuff/install-software.sh @@ -55,8 +55,8 @@ function install_collection () { echo "----- Install extra utilities: ncdu, zip, iftop -----" install_collection 'extra utilities' ncdu zip unzip iftop -echo "----- Install nginx + php-fpm + certbot -------------" -install_collection 'nginx, php-fpm, certbot' nginx certbot python-certbot-nginx php-cli php-fpm php-curl php-gd php-imagick php-intl php-json php-mbstring php-mysql php-redis php-soap php-xml php-yaml php-zip +echo "----- Install nginx + certbot -----------------------" +install_collection 'nginx, certbot' nginx certbot python-certbot-nginx echo "----- Add nginx logging conf ------------------------" read -p 'Install the "tabbed_detailed" nginx log format? [y/N]: ' nginx_log @@ -64,13 +64,18 @@ case $nginx_log in [Yy]* ) LOCATION=`dirname "$0"` mkdir -p "/etc/nginx/conf.d" + mkdir -p "/etc/nginx/snippets" sudo cp "${LOCATION}/nginx/logging.conf" "/etc/nginx/conf.d/logging.conf" + sudo cp "${LOCATION}/nginx/cache-control.conf" "/etc/nginx/snippets/cache-control.conf" ;; * ) echo 'Skipping' ;; esac +echo "----- Install php-fpm -------------------------------" +install_collection 'php-fpm' php-cli php-fpm php-curl php-gd php-imagick php-intl php-json php-mbstring php-mysql php-redis php-soap php-xml php-yaml php-zip + echo "----- Install redis-server --------------------------" install_collection 'redis-server' redis-server diff --git a/one-time-stuff/nginx/cache-control.conf b/one-time-stuff/nginx/cache-control.conf new file mode 100644 index 0000000..bb6e279 --- /dev/null +++ b/one-time-stuff/nginx/cache-control.conf @@ -0,0 +1,22 @@ +# comment + +# useful if you statically generate your website +#location ~* \.(html|pdf)$ { +# # cache documents for a day +# add_header Cache-Control "public, max-age=86400"; +#} + +location ~* \.(js|css|txt)$ { + # cache static-assets for a week + add_header Cache-Control "public, max-age=604800"; +} + +location ~* \.(png|jpg|jpeg|gif|ico|svg)$ { + # cache images for a month + add_header Cache-Control "public, max-age=2592000"; +} + +location ~* \.(ttf|otf|eot|woff|woff2)$ { + # cache fonts for a year + add_header Cache-Control "public, max-age=31536000"; +}