Last active
March 13, 2018 20:12
-
-
Save sanderpick/c993b0df23f2ad638224c6c88338d35b to your computer and use it in GitHub Desktop.
Install an nginx reverse proxy + cache for an ipfs-cluster peer gateway on Amazon Linux.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# install nginx | |
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | |
sudo yum install ./epel-release-latest-7.noarch.rpm -y | |
sudo yum install nginx -y | |
rm epel-release-latest-7.noarch.rpm | |
# grab config files | |
wget https://gist.github.com/sanderpick/bead03b36712f292a3ddcd657d6afe65/raw/41fd86915e5b6df1a9fab5220523ea6acbb25636/ipfs-gateway-nginx.conf | |
sudo mv ipfs-gateway-nginx.conf /etc/nginx/nginx.conf | |
wget https://gist.github.com/sanderpick/bead03b36712f292a3ddcd657d6afe65/raw/41fd86915e5b6df1a9fab5220523ea6acbb25636/nginx-gzip.conf | |
sudo mv nginx-gzip.conf /etc/nginx/conf.d/gzip.conf | |
# setup cache dir | |
sudo mkdir -p /data/nginx/cache | |
# fix nginx bug (https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864/comments/2) | |
sudo mkdir /etc/systemd/system/nginx.service.d | |
sudo bash -c 'printf "[Service]\nExecStartPost=/bin/sleep 0.1\nRestart=always\n" > /etc/systemd/system/nginx.service.d/override.conf' | |
sudo systemctl daemon-reload | |
# start | |
sudo systemctl start nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Run the installer
Sanity check
Tail nginx Logs