Reputation: 2326
I'm trying to use Port 80 as a non-root user and I've seen the discussions about using IP Tables but I'd like to use the tomcat configuration files to be able to modify these bindings. There is an option for AUTHBIND
that allows using ports <1024 but I have no idea where the Spring tomcat files are located... There is no tomcat service running when I start my Spring process so where is the Spring tomcat server actually located? Where can I see the configuration files etc?
Upvotes: 1
Views: 1049
Reputation: 103
You can run this command
sudo su -
setcap 'cap_net_bind_service=+ep' $(which java) # or if you put java path directly for example /usr/lib/jvm/bellsoft-java21-amd64/bin/java
This will allow user to use ports lower than 1024 with non-root privilege.
Upvotes: 0
Reputation: 1070
Do follow steps:
1. Go to your application.properties if it doesn't exist.
2. Create a application.properties inside src/main/resources folder.
example->/src/main/resources/application.properties
3. Simply add this property server.port = 80 or if you want it to be random do server.port = 0
Upvotes: -2
Reputation: 4558
I think you have a wrong approach. I don't recommand you to try to use HTTP port 80 directly.
A good practice is to use Apache HTTP Server redirection or alias :
Explaination :
You will start your Tomcat with "classic" port (such as 8080 or 9080 or anything else over 1024). Then, you will configure your Apache server to redirect HTTP request from HTTP port 80 to your Tomcat server.
Upvotes: 3