Telnet localhost fails to connect (Apache and httpd running normally) - apache

My apache services are working on solaris server. It will be running normally for days but suddenly it hangs. httpd will shown process running but telnet localhost will not connect.

telnet localhost will only connect if you are running a local telnet server...I believe Sun started turning that off by default in Solaris 10.
telnet localhost 80 will try to connect to port 80, where your Apache server might be running. But many Apache configurations are not set to listen on localhost. Instead, try telnet XXX 80, where XXX is the IP number that Apache is listening on. You can see a list of the IP addresses on your current zone with ifconfig -a.
If Apache really IS hanging, you are going to need to gather more information, like
what happens when you telnet into it
what is the output of netstat -an | grep LISTEN | grep '\*\.80'
does it start working again when you HUP the main process (look for the pid which is the parent of all the others)
what is in the main Apache error_log?
Apache is extremely stable, and if it's hanging, you likely have a either an astable plugin, or somehow you are consuming too many of some resource (like you have a 1000-child limit and 1000 people doing http long poll or something)

Related

Trouble starting Apache24

I was following along with a tutorial on Youtube and everything was going well until I started the service for Apache24. I realized that something was running on port 80. I looked in my command prompt and I realized that there are two things that were with port 80. The first one was Apache24 which is listening to port 80 and the other is chrome which is established on port 80. What should I do?
Try finding out which service hogs port 80 and stop that service. Or, kill the offending process.
netstat -tulpen will show you which process (it's process ID is listed as PID on the very right of the output) uses port 80 (listed underneath Local Address, look for the :80 part). Note the PID.
Do a kill {PID}, so if the PID is, for example, 123, do kill 123. If that does not work, try to be be more ride and issue a kill -9 {PID}.

SSH Remote Tunnel port

I have 3 computers 2 Linux and 1 Windows.
Windows PC and Linux server (A) are on the same network (1).
The linux server (B) is on another network (2).
I want to make an SSH tunnel between the 2 linux servers to allow the Windows PC to access an HTTP page of the Linux server (B), which is therefore on another network.
With this command on the linux server (A) the tunnel works fine but only locally in linux.
ssh -R 8080:localhost:80 linuxa.internet.com
But from Windows PC I cannot access port 8080 on linux (A). http://linuxa.local:8080 does not work.
So I tried these two commands to open access to my PC but it doesn't work either.
ssh -R 0.0.0.0:8080:localhost:80 linuxa.internet.com
ssh -R ipwindows:8080:localhost:80 linuxa.internet.com
Can you help me ?
Thank you
From a comment, I conclude that you might have problem with the firewall. Suppose you can reach the tunnel from the host that is "proxy" (with curl,wget,ncat etc. on localhost). You should check what block traffic. In most cases, it is a firewall. Depending on your Linux distro you might have different backends and frontends for a firewall. If you have firewall-cmd command installed it's very likely that firewalld is one.
But before blaming the firewall, you should check if a port is open/closed. I prefer netcat:
HOST_THAT_SHOULD_HAVE_OPEN_PORT # nc -l 8080
HOST_THAT_SHOULD_BE_ABLE_TO_CONNECT # nc HOST_THAT_SHOULD_HAVE_OPEN_PORT 8080
If there is no connection or connection is refused, it's extremely likely that the firewall is the problem.
You can check if firewalld is running with systemctl:
# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-02-08 21:42:29 CET; 13h ago
Then you might add traffic on port 8080:
# firewall-cmd --add-port 8080/tcp
success
It will temporarily open network traffic on 8080. Then you should be able to use port 8080 and your ssh tunnel.
Thank you for your answer but I don't think I have a firewall installed
systemctl status firewalld
return
Unit firewalld.service could not be found.
and
firewall-cmd --add-port 8080/tcp
-bash: firewall-cmd: command not found

Apache configured to listen on port 80 only but instead listening on port 8080 as well

I was not able to use port 8080 because it was apparently already used.
In order to see which program was using it, I typed the following command in my terminal (on MacOS):
sudo lsof -n -i :8080
Here's the result:
httpd is also listening on port 80, which I found out by using the following command:
sudo lsof -n -i :80 | grep LISTEN
Here's the result:
So I went to find out what this "httpd"-process was. Apparently it is basically the web server installed on my machine. The web server installed on my machine is Apache2.
Given this fact I concluded that Apache2 was apparently configured to listen on port 80 AND on port 8080.
BUT: Here's the crazy thing: I went to the folder /etc/apache2 and opened the file "httpd.conf". In the file Apache is configured to listen on port 80 only !!!
Why the hell is it also listening on port 8080 ?!
How can I make it listen on port 80 only ?

how to solve Apache Error i already changes the ports but couldn't what the Error is?

03:32:35[Apache]Problem detected!
03:32:35[Apache]Port 80 in use by "Unable to open process" with PID 4!
03:32:35[Apache]Apache WILL NOT start without the configured ports free!
03:32:35[Apache]You need to uninstall/disable/reconfigure the blocking application
03:32:35[Apache]or reconfigure Apache and the Control Panel to listen on a different port
03:32:35[Apache]Attempting to start Apache app...
03:32:35[Apache]Status change detected: running
As log said, Port 80 is already used by another process
to check wich process use port :
WINDOWS: netstat -a -b
LINUX : sudo netstat -tulpn (must run with root)
To change the port of Apache, you have to modify this file:
APACHE_INSTALLATION_PATH/conf/httpd.conf and change this configuration Listen 80 to the port you want to use, example : Listen 8085
N.B: in your browser you must type this url http://www.mywebsite.com:8085 instead of http://www.mywebsite.com ( == http://www.mywebsite.com:80)
You must restart your apache server
I think that skype is using port 80, but i'm not sure

Is it good to release these ports?

When I am trying to start Apache server from Eclipse, I am getting message as:
Several ports (8085, 8009) required by Tomcat v6.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
I find the ports are opened by any process by the OS using "netstat -an"
I found below data as listening.
TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING
TCP 0.0.0.0:8085 0.0.0.0:0 LISTENING
TCP [::]:8009 [::]:0 LISTENING
TCP [::]:8080 [::]:0 LISTENING
TCP [::]:8085 [::]:0 LISTENING
I don't know whether this are useful process, or can I release this ports.
If tomcat is already running eclipse will report this. This could happen if eclipse crashed.
If you only have one instance of tomcat on your machine
Try stopping it
bin/shutdown.sh
or on windows
bin/shutdown.bat
and then restarting tomcat from eclipse.
On linux
You can verify those ports are in use by another tomcat (or the same one that is already running) with
netstat -anp #running as the superuser the -p option will say what the process is
You can then check the process table to cross reference the ports
ps aux | grep java
or
ps aux | grep 1234 #replacing 1234 with the PID reported by netstat
If it is tomcat and it won't shutdown after running bin/shutdown.sh then you can kill it using the kill commmand.
If you do have something else that is using those ports
edit conf/server.xml
change the ports that tomcat will use, try 6080, 6005, etc
start tomcat from eclipse again