Created
October 6, 2017 17:34
-
-
Save whyvez/390f2600e6b2bacba165391ba3b19b3a to your computer and use it in GitHub Desktop.
Install NGINX as proxy
This file contains 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 | |
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