Running grafana behind apache2 reverse proxy - apache2

I need to run grafana and kibana on a same server while running behind Apache2 reverse proxy
I manage to succeed with kibana, but grafana cause me some problems; in fact I don't how how to run the sub path.
I want these two services to run like this : X.X.X.X/kibana and X.X.X.X/grafana.
Here is my apache2 config and my grafana settings:
<VirtualHost *:80>
ServerName http://myipadress/kibana
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://myipadress:5601/
ProxyPassReverse / http://myipadress:5601/
</VirtualHost>
#--------------GRAFANA----------------------------
<VirtualHost *:80>
ServerName http://myipadress/grafana
ProxyRequests On
ProxyPreserveHost On
ProxyPass / http://myipadress:3000/
ProxyPassReverse / http://myipadress:3000/
</VirtualHost>
For grafana :
protocol = http
http_port = 3000
domain = myipadress
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana
serve_from_sub_path = true
Does anyone know what I did wrong
Cheers

Hello after loosing too much time on it, I decided to change my reverse proxy and use NGINX.
I fact, there is a example of configuration in grafana's documentation, and I just added these lines
location /kibana {
proxy_pass http://localhost:5601/kibana;
}
And it just work for me

Related

Apache - exposing webapp on port using subdomain / route with SSL

I'm trying to expose web app via subdomain with SSL or via route.
Subdomain Method:
The webapp I'm running is on port: http://localhost:4567/
With the following configuration, the web browser tells me the app is "not secure" (non-https).
The app is generally working fine, but is non-https.
What am I doing wrong?
Are there alternative configurations?
<IfModule mod_ssl.c>
Listen 443
NameVirtualHost *:443
</IfModule>
<VirtualHost *:80>
ServerName blast.example.com
Redirect permanent / https://blast.example.com/
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin me#gmail.com
ServerName blast.example.com
# ProxyPreserveHost On
ProxyRequests off
# setup the proxy
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
# ProxyPass / http://localhost:4567/
# ProxyPassReverse / http://localhost:4567/
<Location />
ProxyPass http://localhost:4567/
ProxyPassReverse http://localhost:4567/
</Location>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL
SSLCertificateFile ...
SSLCertificateKeyFile ...
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
I had been following the prescription given at How to configure multiple subdomain with SSL in Apache?
Path/Route Method
I had also tried exposing the app as a route path (ie https://example.com/blast)
<Location /blast/ >
ProxyPass http://localhost:4567/
ProxyPassReverse http://localhost:4567/
</Location>
but the reverse proxy didn't see to work in that, if I started with:
https://example.com/blast
And clicked whatever on the start page.
The app would generate a internal URL without the /blast part, resulting in 404:
https://example.com/blah-blah-generated-url
(should be https://example.com/blast/blah-blah-generated-url)
In general, the subdomain path seems to work better except for the non-https problem.
Setting up a path/route:
Making the application accessible with https://example.com/blast. If the application generates new routes, ProxyPassReverse is needed; otherwise; only ProxyPass is needed.
<VirtualHost *:443>
...
ProxyPass "/blast/" "http://localhost:4567/"
ProxyPassReverse "/blast/" "/"
...
Found in Example 1, here: ProxyPassReverse doesn't rewrite Location (http header)

Odoo 8 deploy website with reverse proxy (apache2)

Hello I'd like to deploy my website using Apache2, my domainname is www.hew-automation.be. I've already made a link from this domainname to my server's IP Address (http://91.183.84.209:8080/). I want to get rid of the port 8080 and also stop displaying the IP address in the browser.
I installed apache2, added following to /etc/apache2/sites-available/odoo.conf:
<VirtualHost *:80>
ServerName hew-automation.be
ServerAlias *.hew-automation.be // Use this if you want dbfillter on subdomain
ErrorLog /var/log/odoo/odoo-error.log
CustomLog /var/log/odoo/odoo-access.log combined
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ProxyVia On
LogLevel warn
</VirtualHost>
Then enabled this with a2ensite, this without any errors.
This is my /etc/odoo-server.conf file:
[options]
admin_passwd = XXXX
db_host = False
db_port = False
db_user = XXXX
db_password = XXXX
addons_path = /opt/odoo/addons
logfile = /var/log/odoo/odoo-server.log
xmlrpc_port = 8068
Now whenever I surf to my IP-address http://91.183.84.209/, it always shows the default page of Apache2, what am I doing wrong here?
Thanks.

Apache2 Virtual Host 503 error

Here is my apache2 virtual host config -
<VirtualHost *:80>
ServerName A.B.com
ProxyPreserveHost Off
ProxyPass / http://<ServerIP>:<appPort>/<app>/ timeout=3600 Keepalive=On
ProxyPassReverse / http://<ServerIP>:<appPort>/<app>/
ProxyTimeout 3600
</VirtualHost>
<Location "/">
Order allow,deny
Allow from all
</Location>
I have a route 53 entry for A.B.com pointing to this machine (the one with apache2)
I have ran a2ensite.. I am getting a 503 service unavailable on hitting A.B.com
However, A.B.com:appPort/app is working..
This definitely means I am missing something in apache2 configuration.. Can anyone point me out?
ProxyPreserveHost Off
should be on, and not need to mention http://, but in route you can mention http://.
further please check and paste error logs.

Gitlab6.0 and Apache2

please how to set Github 6.0 with Apache2?
Gitlab is installed according to the original instructions
Adjustment in Unicorn.rb
...
#listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 64
#listen "127.0.0.1:8080", :tcp_nopush => true
listen "127.0.0.1:8080"
...
My Apache2 conf is :
<VirtualHost *:80>
ServerName git.domain.com
ErrorLog /var/log/apache2/gitlab_error.log
CustomLog /var/log/apache2/gitlab_access.log combined
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
<Location />
ProxyPassReverse /
Order deny,allow
Allow from all
</Location>
</VirtualHost>
Bud i get :
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /users/sign_in.
Reason: Error reading from remote server
Thank you
In case this helps anyone else;
I had this same problem, but it was a lack of disk space in my case. I deleted some large backups and restarted apache with service httpd restart and my gitlab came back.

How Can I Proxy To Multiple Application Running in Tomcat via mod_proxy

I have 2 web applications running under Tomcat6. Currently, I can access one of them via mod_proxy with the following config...
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerAdmin email#email.com
ServerName staging.domain.com
ProxyPass /app1 http://localhost:8080/app1
ProxyPassReverse /app1 http://localhost:8080/app1
</VirtualHost>
Now, I can access app1 via http://staging.domain.com/app1. I also want to be able to access app2 the same way: http://staging.domain.com/app2. I configured a second VirtualHost however, only the first one works. Is this even possible, to proxy 2 web apps under a single domain? If so, any hints, tips, tricks would be greatly appreciated.
Ah, you're already pretty much doing it: just add extra ProxyPass/ProxyPassReverse statements.
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerAdmin email#email.com
ServerName staging.domain.com
ProxyPass /app1 http://localhost:8080/app1
ProxyPassReverse /app1 http://localhost:8080/app1
ProxyPass /app2 http://localhost:8080/app2
ProxyPassReverse /app2 http://localhost:8080/app2
ProxyPass /app3 http://localhost:8080/app3
ProxyPassReverse /app3 http://localhost:8080/app3
</VirtualHost>

Resources