Setting monit base URL? - monit

I run monit on several servers, usually proying it via nginx as suggested by the monit manual (https://mmonit.com/wiki/Monit/Nginx). That works well on 8 out of 10 servers. But on 2 servers, I encounter issues with the web interface.
Whenever I select a service (e.g. nginx) an click the "Enable monitoring" or "Disable monitoring" button, the action is done, but the response redirects (302) to /nginx instead of /monit/nginx.
As this issue only appears on a few servers (maybe related to Ubuntu 22.04 instead of Ubuntu 20.04), it's a bit hard to track the problem down. Is there an option to tell Monit the base URL to be used for the redirects? Or does it need any more information proxied by nginx?

You can not define a base URL in the Monit configuration.
Is there an option to tell Monit the base URL to be used for the redirects?

Related

JIRA Issue/Filter Macro in Confluence generates invalid link

The setup:
Ubuntu 16.04
JIRA Software 7.03 (on port 8080)
Confluence 6.03 (on port 8090)
NGINX 1.10.0 as a reverse proxy to...
Apache 2.4.18
The problem: Whenever I try to embed a JIRA issue into a Confluence page via the built-in JIRA Issue/Filter macro, the issue is successfully located and its status is successfully listed. However, the link from the Confluence page to the actual issue in JIRA points to localhost:8080.
As per the suggestion in Incorrect Links in JIRA Issues Macro (cause #1), I tried enabling ProxyPreserveHost in Apache, with no discernible effect.
Question 1: Am I even digging in the right direction, or is there some other likely cause for the issue that I'm missing?
Question 2: If the issue really is likely due to a configuration mismatch between Confluence and the web server, where should I start digging, given that I'm using NGINX as a reverse proxy?
I'm very hazy on the specifics of configuring web servers. Do I need to verify my settings in both NGINX and Apache, or just Apache (NGINX is set to pass through pretty much everything non-static)? Do I just follow the instructions for Proxying Atlassian server applications with Apache HTTP Server (mod_proxy_http)?
I haven't done this yet because I'm worried my lack of understanding will cause something to explosively decompress.
Thanks in advance!
Since you redirect to localhost:8080 and 8080 is JIRA's default port, I believe that you need to check following and most likely it's related to misconfiguration of the proxy:
Configuration of JIRA Base URL - Is it configured properly?
Do you have proxyPort and proxyName in the connector of server.xml?
What you are seeing when you navigate to Application Link configuration of JIRA and Confluence? Is is showing any errors?

What would happen if I made a HTTP request to a server without Apache installed?

Doesn't have to be Apache, but that's just the only HTTP server I know of (Actually could you guys recommend alternatives that I could look into as well?)
Anyways, so I have been messing around with Amazon Web Services and I created an EC2 server instance with an Amazon Linux Image. On that, (Following guides and examples) I installed Apache and now when I make a GET request to my public IP, it returns to me the HTML files I created on my server.
My question is, what if I never installed Apache, and then made an HTTP request to my public IP? For no reason really, the question just came up in my head and I'm curious. I'd rather not figure out how to uninstall Apache or create a new instance to figure it out, so I was wondering if somebody could weigh in as well as tell me a little more about what it is exactly apache does on a server. My understanding is that it is a layer you can install on your server OS that will create a socket listener to port 80 (HTTP), and when a request is made on that port, Apache will return web pages? Also I think I read somewhere you could configure Apache to forward a port to something like a python server script?
Thanks in advance for your time!
could you guys recommend alternatives that I could look into as well?)
nginx is a popular alternative to apache. It's much more efficient.
what if I never installed Apache, and then made an HTTP request to my public IP?
Your browser would get a "connection reset" because there is nothing on port 80. Your browser would display a message (Chrome says "This webpage is not available"). You would NOT get a "404" because that requires an HTTP server to send HTTP codes.
If your server was firewalled instead, you'd bet a busy wait for a while, then a message about the server not responding.
Also I think I read somewhere you could configure Apache to forward a port to something like a python server script?
Yes, that is called "reverse proxy" mode. It's essential to any application website if you want to scale. The web server(s) can distribute traffic to one or more backends running the application. The web server is useful for filtering bad requests (since your backend in Ruby/Python will be 1000's of times slower than the reverse proxy.)
Well, if you want to test what will happen if Apache isn't installed, you can always just stop the Apache service by typing:
sudo service apache2 stop
or
sudo service httpd stop
depending on your version. Then if you visit your site's webpage you'll get a 404 error or something similar.
There are ways to use python scripts to run simple servers, but in general it's easier to just let Apache handle that and use a framework like Ruby on Rails or Django to control the display and creation of content for your server.

Xampp's APACHE not working?

I have installed/reinstalled Xampp server on my laptop for a million times now, and still Apache is not running. At first, it will Run, but few moments later it will automatically stop. I don't know what seems to be the conflict. I have checked my Skype since I once met a conflict on the port usage but in this case, I haven't installed Skype. Can someone please guide me on how to make my Apache run successfully. Note that my mySql runs smoothly, only Apache won't. Please help..:(
P.S.
When I run my xampp-control panel, mySql runs smoothly whereas Apache will run for a moment and then will stop, below in the control panel, it will then say apache[port 80] is busy.
What caused this problem on my system (Windows 7) was that the WinHTTP Web Proxy Auto-Discovery Service had stopped running. In the Services part of the Computer Management feature (i.e. the app that runs by selecting Manage from the right-click menu on the Computer link on the Start Menu), I found that WinHTTP Discovery Service was set to 'Manual'. I left it as 'Manual', but started it, and Apache began working again.
Even though I didn't change the 'Manual' nature of the service's startup, I discovered that, after Windows reboot, the WinHTTP service was still running (which was a bit puzzling to me, but there we are). I also don't know what caused this service to stop running on my machine ('but there we are' again!)
Anyway, it seems that having WinHTTP Web Proxy Auto-Discovery Service running is necessary for Apache to run, so make sure it's running!
EDIT TO ADD: I found the root cause of my problem: I'd downloaded a free game that uses Pando (peer-to-peer file sharing app) to allow others to download the game from my machine too (which, in principle, I was okay with), and it uses TCP port 443, which was stopping Apache running. I assume (though really don't know enough about networking to be sure) that the running of the WinHTTP Web Proxy Auto-Discovery Service mentioned above was managing to share (or otherwise work around) the use of port 443.
Open a cmd as Administrator (Start -> "cmd" -> right-click "cmd.exe" -> Run as Administrator)
Type
netstat -nab
Find the line that says
TCP 0.0.0.0:80
well or basically every line that ends with :80
See the exe that's blocking the port above the line.
Terminate the associated program - if nothing else works the Task-Manager should help.
EDIT: Usually IIS would block Port 80 if it is started. There are quite a lot of other programs that could block port 80 though. You can also try and
telnet localhost 80
and see what kind of service answers. Or... use a webbrowser. Or... configure apache to use a different port (but who wants to do that?)
Reconfigure Apache to run on a different port
You might want to pick this path if you don’t want to close the application blocking port 80. A typical reason might be that you want to run say, Apache and IIS on the same machine at the same time.
To configure Apache to run on a different port, goto this path "C:\xampp\apache\conf" (if you install Xampp on diffrent place then navigate to this path) and open httpd.conf in notepad. Search for the following lines:
Line 1 : Listen 80
Line 2 : ServerName localhost:80
Change both these lines, so as to have a different number instead of 80. I have chosen 8000 instead of 80. Make sure that this is a free port, not used by any applications.
Line 1 : Listen 8000
Line 2 : ServerName localhost:8000
Save the file and run Apache from Xampp
Try disabling your Anti-Virus software temporarily. It's known to cause Apache problems. Also check Apache error.log file to see if it has recorded any issues.
Also try some other WAMPs to see if it's a common problem on your system.
Skype automatically blocks the port 80
Stop Skype - Try the apache to start from xampp dashboard
If apache Works - change skype settings
1) In the system tray, we click on the xampp icon.
2) Select Apache> httpd.conf
3) Make a call to Listen 80.
4) Change the number 80 next to Listen to 9080.
5) Restart XAMPP's services

is setting tomcat application url to http:// hostname/application/ possible?

I have a setup, with tomcat running on port 8080 and apache webserver running on port 80.
So if I access http://localhost:8080/myapplication/ , it works.
But I need to be able to make it like : http://localhost/application/, but since my http web server runs on port 80, it seems that i need some re-direction logic or changes at the tomcat to achieve this.
Can anyone please suggest i way out. Thanks.
UPDATE:
Just found that there is already a solution provided here: How do I redirect from Apache to Tomcat?
You need to look at the Tomcat-Apache HOWTO.
It is entirely possible and in fact quite common for apache and tomcat to be used in combination by the tactics described in this page.
And this question really probably belongs on serverfault...
Since you mentioned about "users", I am guessing you are implying "hostname", when you mention "localhost". If you have a Load Balancer and a user friendly DNS name that you would give to the users, you can configure your Load Balancer software to route all requests to "hostnameyougavetotheUsers" to "yourinternalhostname:8080".

How to bind an ip AND ports to subdomains using JBoss (Or Apache Tomcat)

This is my problem:
I have a JBoss server (Running an existing app) and a Apache Tomcat (Running an app created by me) server running on the same server with different ports.
I have two subdomain names which i have routed to the IP of the server.
What i need to do is to bind the subdomain names to the IP, but with different ports.
I saw an easy way to do it with XAMPP and apache, editing the httpd.conf, but i can't find any simular fway to do it with Apache Tomcat or JBoss.
Does anyone have any ideas about this?
I rather have a solution on the question above, but the question below can be accepted as a backup solution:
Since i could not figure that out, i had to at least have a solution to one of the applications (the one running at JBoss).
So i configured JBoss to port 80 instead of 8080.
What happens now if i go to the subdomains is that i get the JBoss welcome window.
How can i change the default JBoss "app" to my app?
Thanks in advance
There's no way to get this:
sub1.domain.com(192.168.0.1) on port 80 --> jboss app
sub2.domain.com(192.168.0.1) on port 80 --> tomcat app
without either adding to or subtracting from your software stack.
Your options are:
use jboss to run your tomcat app
add a reverse-proxy
use an HTTP-aware layer 7 firewall
The first is probably easiest; jboss deploys web applications using tomcat (or, in more recent versions, a fork of tomcat called jbossweb), so you can probably just drop your .war into the deploy directory.
If that's not possible for some reason, I'd use a reverse-proxy. Apache HTTPD with mod_proxy or mod_jk is fairly common. If you go the mod_jk route and you have non-trivial load, I'd review this.
The last I'm not familiar with. I imagine that the spendy Cisco firewalls can do this, and I'm sure it's possible to hack iptables to do it too, but my google-fu failed to find specifics.