Skip to content

Instantly share code, notes, and snippets.

@whyvez
Created October 6, 2017 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whyvez/390f2600e6b2bacba165391ba3b19b3a to your computer and use it in GitHub Desktop.
Save whyvez/390f2600e6b2bacba165391ba3b19b3a to your computer and use it in GitHub Desktop.
Install NGINX as proxy
#!/usr/bin/env bash
url=$1
sudo yum update -y
sudo yum install nginx -y
sudo bash -c "cat >/etc/nginx/nginx.conf" <<EOF
user nginx;
worker_processes 1;
error_log off;
pid /var/run/nginx.pid;
include main.d/*.conf;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass ${url};
}
}
}
EOF
sudo chkconfig nginx on
sudo service nginx start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment