Apache Httpd VS. Tomcat 7: Port 80 VS. Port 8080

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.
Sample Image

  1. Open Eclipse

  2. Go to Servers panel

  3. Right click on Tomcat Server select Open, Overview window will appear.

  4. Open the Portstab. You will get the following:

    • Tomcat adminport

    • HTTP/1.1

    • AJP/1.3

  5. I changed the port number of HTTP/1.1 (i.e. to 8081)

  6. You might have to also change the port of Tomcat adminport (i.e. to 8006) and of AJP/1.3 (i.e. to 8010).

  7. Access your app in the browser at http://localhost:8081/...



Related Topics



Leave a reply



Submit