Created
May 18, 2020 20:21
-
-
Save imperialguy/ea332fd94fc30a1f2703c3c54b0975ca to your computer and use it in GitHub Desktop.
RabbitMQ / NGINX
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
user lbakken lbakken; | |
worker_processes 1; | |
# Note: for debugging, very useful | |
# error_log /dev/stderr debug; | |
error_log /dev/stderr; | |
pid nginx.pid; | |
worker_rlimit_nofile 1024; | |
daemon off; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
client_body_temp_path /tmp/nginx; | |
fastcgi_temp_path /tmp/nginx; | |
scgi_temp_path /tmp/nginx; | |
uwsgi_temp_path /tmp/nginx; | |
proxy_temp_path /tmp/nginx; | |
access_log /dev/stdout; | |
upstream rabbitmq { | |
least_conn; | |
server localhost:15672 weight=10 max_fails=3 fail_timeout=30s; | |
} | |
server { | |
listen 8888; | |
server_name 127.0.0.1; | |
# Note: a big thanks to this answer: | |
# https://stackoverflow.com/a/37584637 | |
location /rabbitmq/api/ { | |
rewrite ^ $request_uri; | |
rewrite ^/rabbitmq/api/(.*) /api/$1 break; | |
return 400; | |
proxy_pass http://rabbitmq$uri; | |
} | |
location /rabbitmq { | |
rewrite ^/rabbitmq$ /rabbitmq/ permanent; | |
rewrite ^/rabbitmq/(.*)$ /$1 break; | |
proxy_pass http://rabbitmq; | |
proxy_buffering off; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment