Skip to content

Instantly share code, notes, and snippets.

@veysiertekin
Created February 28, 2020 13:38
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 veysiertekin/89f09ba179e45e686185fa2f19897351 to your computer and use it in GitHub Desktop.
Save veysiertekin/89f09ba179e45e686185fa2f19897351 to your computer and use it in GitHub Desktop.
nginx

Reverse Proxy Setup

  • Install nginx
yum install nginx -y
  • Setup the reverse proxy
cat <<EOF >> /etc/nginx/conf.d/reverse-proxy.conf
server {
    listen <port>;
    listen [::]:<port>;

    location / {
        # replace host:port definitions with new one in response bodies
        sub_filter '<host:port>' '<new host>';
        sub_filter_types *;
        sub_filter_once off;

        # allow response body manipulation
        proxy_set_header Accept-Encoding "";
        # proxy all traffic to
        proxy_pass <protocol>://<host>:<port>;
        # replace redirect 'Location' headers with new one
        proxy_redirect <old protocol://host:port> <old protocol://host:port>;
    }
}
  • restart nginx
systemctl restart nginx.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment