Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run it behind an nginx proxy. #59

Closed
minhajuddin opened this issue Feb 7, 2012 · 4 comments
Closed

Unable to run it behind an nginx proxy. #59

minhajuddin opened this issue Feb 7, 2012 · 4 comments

Comments

@minhajuddin
Copy link

I am trying to run it behind an nginx proxy. But, the links have a "http://127....:2464/.." I understand that it's picking up these from the /etc/amon.conf . How can I tell the amon web process to use the nginx proxy's host and port?

@martinrusev
Copy link
Member

You have to tweak both nginx and amon for this to work.
Your nginx.conf should be something like this - https://gist.github.com/1758908

Amon has a base_url variable, which is constructed from the port/host found in amon.conf, so what you need to do is - change those values to match the nginx configuration.

If your nginx server runs on 127.0.0.1 (no port ), remove the port value in /etc/amon.conf and in /etc/init.d/amon - find the line which says int(settings['port']) and change it to the 2464( or something else, if its more convenient )

@minhajuddin
Copy link
Author

Thank you for such a quick response

For future users, I had to do the following:

  1. My nginx was already like the one one referred by @martinrusev ( https://gist.github.com/1758908 ). But, you need that.

  2. Change /etc/amon.conf

  "web_app": {
        "host": "log.awesome.com",  //nginx host
        "port": "80" //nginx port
    }, 
// remove the comments from above lines
  1. Most important of all make the following changes to /etc/init.d/amon
#change line #33 to the following, so that the amon webapp doesn't try to listen on port 80
application.listen(int(2464))

@martinrusev Thank you for creating such an awesome app :)

@zshannon
Copy link

For reference, it works slightly differently if you want to use SSL.

Here's my nginx host (using 10.10.10.10 as an example external IP):

upstream amon_server {
server 127.0.0.1:2464;
}

server {
listen 10.10.10.10:443;
server_name amon.example.com;
ssl on;
ssl_certificate /var/ssl-certs/amon.example.com/amon_example_com.crt;
ssl_certificate_key /var/ssl-certs/amon.example.com/amon_example_com.key;

ssl_session_timeout 5m; 

ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;

location / { 
    proxy_set_header Host $host; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_pass       http://amon_server$1;
}

}

And the corresponding /etc/amon( | plus).conf:
{
"secret_key": "************************************************",
"web_app": {
"host": "https://amon.example.com",
"port": "443"
},
"backend": {
"mongo": {
"host": "127.0.0.1",
"port": 27017
}
}
}

And finally, /etc/init.d/amon( | plus) change "application.listen(int(settings.WEB_APP['port']))" to "application.listen(int(2464))".

@martinrusev
Copy link
Member

Thank you, I will add that info to the official documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants