Skip to content

Instantly share code, notes, and snippets.

@michaelklishin
Created July 11, 2013 14:39
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 michaelklishin/10eae3a1ab57c2a8cb72 to your computer and use it in GitHub Desktop.
Save michaelklishin/10eae3a1ab57c2a8cb72 to your computer and use it in GitHub Desktop.
upstream rabbit1 {
server 127.0.0.1:15672;
}
upstream rabbit2 {
server 127.0.0.1:15673;
}
upstream rabbit3 {
server 127.0.0.1:15674;
}
server {
server_name rabbit1.rabbitproxy.local;
index index.htm index.html;
root /Users/antares/Tools/rabbitmq/cluster1/node1;
location / {
proxy_pass http://rabbit1;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host rabbit1.rabbitproxy.local;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
server_name rabbit2.rabbitproxy.local;
index index.htm index.html;
root /Users/antares/Tools/rabbitmq/cluster1/node2;
location / {
proxy_pass http://rabbit2;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host rabbit2.rabbitproxy.local;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
server_name rabbit3.rabbitproxy.local;
index index.htm index.html;
root /Users/antares/Tools/rabbitmq/cluster1/node3;
location / {
proxy_pass http://rabbit3;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host rabbit3.rabbitproxy.local;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
@jarvinia
Copy link

jarvinia commented May 7, 2015

Could you have a look at this? I got an error user openlearning not found: /api/whoami when using this apache virtual host config file:

<VirtualHost *:80>
ProxyPreserveHost On
# DocumentRoot /var/www

    AllowEncodedSlashes On

    ProxyPass /api http://rabbitmq1.openlearning.local:15672/api nocanon
    ProxyPass / http://rabbitmq1.openlearning.local:15672/
    ProxyPassReverse / http://rabbitmq1.openlearning.local:15672/

    ServerName rabbitmqproxy.openlearning.com

    <Location />
        Order allow,deny
        Allow from all
    </Location>

    ErrorLog ${APACHE_LOG_DIR}/rabbitmqproxy.openlearning.com.error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug

    #SSLEngine On

    #SSLCertificateFile /etc/apache2/ssl/servercert.pem
    #SSLCertificateKeyFile /etc/apache2/ssl/server.key
     # For web access by humans.
    <Location "/">
            AuthType basic
            AuthName "Rabbitmq"
            Require valid-user
            AuthBasicProvider file
            AuthUserFile /etc/apache2/passwords
    </Location>

    CustomLog ${APACHE_LOG_DIR}/rabbitmqproxy.openlearning.com.error.log combined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment