Apache httpd vs. Tomcat 7: port 80 vs. port 8080
The difference is mostly historical at this point, but still enforced by Linux and most Unix implementations that I can think of. Unix/Linux considers any port number < 1024 to be "privileged" and requires root privs to bind to them. Any user should be able to bind to ports higher than 1024. If your software package is of a certain vintage it expects to be started as root, bound to a port, and optionally it will then change effective UID to a non-privileged user. Apache HTTPD falls into this category. Software packages created later on (ie Apache Tomcat) typically went the route of doing everything with a non-privileged user and binding to a higher port number by default.
Some firewall admins can, I'm sure, go into detail about how port < 1024 will sometimes get special treatment in firewall configurations in some cases.
Apache 2.4.6 and Apache Tomcat 7.0.42 on Port 80
So I managed to solve this problem by Using Mod_Proxy. Editing the 000-Deafult.conf file in /etc/apache2/sites-enabled and adding the following lines:
ProxyPass /SomeUrl !
ProxyPass / http://localhost:8080/
The first line indicates what you don't want to proxy and the second one indicates what to proxy.In this case forward the ROOT app of Tomcat at port 8080 to the root of the Apache web server
Also edited the server.xml file in /etc/tomcat7 and added the following
<Connector port="8080" protocol="AJP/1.3" proxyName="www.mydomain.com" proxyPort="80"/>
Tomcat Apache port 80 port 8080
You may need a ProxyPassReverseCookieDomain since you're forwarding between your domain and localhost. – Joachim Isaksson 3 hours ago
Why does Tomcat work with port 8080 but not 80?
go to /etc/default/tomcat6 and change #AUTHBIND=no
to AUTHBIND=yes
# If you run Tomcat on port numbers that are all higher than 1023, then you
# do not need authbind. It is used for binding Tomcat to lower port numbers.
# NOTE: authbind works only with IPv4. Do not enable it when using IPv6.
# (yes/no, default: no)
#AUTHBIND=no
How to get Tomcat 7 to run on Port 80 on Windows Server 2008?
Some other app is using port 80. Do a local port scan and print executable path with netstart (This video will help :
https://www.youtube.com/watch?feature=player_detailpage&v=V3nWkr7v4-E#t=7)
Often its skype (or other chat or peer to peer file sharing app). Shutdown skype (quit not just sign out, process should exit) then start tomcat. Then can restart skype it will work fine on some other ports.
Also is there any firewall entry stopping Java from binding to this port? Can check that from your firewall rules - if your using default windows firewall that will be there in Control panel. https://www.youtube.com/results?search_query=widows+firewall+java+allow these results or same terms in regular search engine will tell you steps to allow Java. Usually windows asks the first time you run an app. So if you said no then it remembers that. Also will need to have administrator role (logged in/ or on prompt user) to make these changes. For some issues helps to open admin console too. right click on cmd.exe and choose run as administrator, say yes to the security prompt.
This program might help, save it to a file called "PortCheck.java"
class PortCheck{
public static void main(String []args) throws Exception{
String port = "80";
if(args.length > 0)port = args[0];
final int p = Integer.parseInt(port);
Thread t = new Thread(){
public void run(){
try{
java.net.ServerSocket s = new java.net.ServerSocket(p);
System.out.println("\nListening on port " + p);
s.accept();
}catch(Exception e){
System.out.println("Err " + e);
}
}
};
t.start();
Thread.sleep(2000);
System.out.println("Bye ");
System.exit(0);
}
}
Compile it
javac c:\_your_path\PortCheck.java
and run it :
java -cp c:\_your_path PortCheck
If it succeeds to bind to 80 will tell you :
Listening on port 80
Bye
Can try with port 443 too simiarly
Tomcat Server Error - Port 8080 already in use
All I had to do was to change the port numbers
.
Open
Eclipse
Go to
Servers panel
Right click on Tomcat Server select
Open
,Overview window
will appear.Open the
Ports
tab. You will get the following:Tomcat adminport
HTTP/1.1
AJP/1.3
I changed the port number of
HTTP/1.1
(i.e. to8081
)You might have to also change the port of
Tomcat adminport
(i.e. to8006
) and ofAJP/1.3
(i.e. to8010
).Access your app in the browser at
http://localhost:8081/...
Related Topics
Install Library in Home Directory
Sed Regex Problem on Mac, Works Fine on Linux
Using Output of Previous Commands in Bash
Implementing Basic File System
Does File ".Bash_History" Always Record Every Command I Ever Issue
Self Updating Bash Script from Github
Limit Top Command to Only Display Top X Processes on Command Line
What's The Meaning of 'Blacklisted' on Gstreamer
Linux: How to Put a Load on System Memory
How to Redirect Ip Address Using Iptables
Load Warning: Cannot Find Entry Symbol _Start
Best Way to Build Cross Toolchains on MAC Os X
Capture Stdin/Stderr/Stdout of a Process After It's Been Started, Using Command Line
Running a Script Just Before Installation of Debian Finishes Using Preseed
Does I2C Driver Need to Be Implemented Just Like Any Other Character Device Driver
Customize Tab Completion in Shell
How to Monitor Cwnd and Ssthresh Values for a Tcp Connection