Standalone WebApp on Linux with non-root user

Hi everyone,

I created a webapp that I start on a Fedora 31 server in standalone mode.
With the root user it starts quietly, with a user I created (myu) it does not start.

The application is in folder /var/www/myapp

drwxr-xr-x. 4 myu myu 4096 January 29 3:30 pm myapp

And the files inside are configured as follows:

-rwxr-xr-x. 1 myu myu 20856256 January 29 16:28 MyApp
drwxr-xr-x. 2 myu myu 4096 Jan 29 15:15 'MyApp Libs'
drwxr-xr-x. 3 myu myu 4096 Jan 29 15:15 'MyApp Resources'

With the user myu it does not start and no messages are returned.
Can anyone give me some suggestions?

PS: It is a standalone, there is no apache.

Are you using a high numbered port? Lower numbered ports require root privileges.

@KevinW The port is 80, because I want that when I write the domain (www.mydomain.com) to see the webapp directly without writing the port. Is there a security problem if I start the webapp with root?

I read on a Unix portal. I should reindeer like 8080 on 80. Thanks a lot for your help.

Whether or not running it as root is a problem is really up to you. If you think it’s too risky with what your app is doing you can use a proxy or a port redirect with iptables, or even use your internet router to do that and just run the app on 8080 or some other high numbered port.

It just depends on what your specific needs are. I usually run my apps behind haproxy or another webserver so I can have multiple instances running for redundancy and load balancing. If it’s something that doesn’t see a lot of traffic I usually run just two instances.

1 Like

Many thanks. I will try to point the 80 with iptable to my 8080 of my standalone webapp. Thank you very much.