babelouest / ulfius

Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language. Can stream large amount of data, integrate JSON data with Jansson, and create websocket services
https://babelouest.github.io/ulfius
GNU Lesser General Public License v2.1
1.08k stars 182 forks source link

Can't use port 80? #116

Closed hmkim123 closed 5 years ago

hmkim123 commented 5 years ago

There is a error when port number is 80. The error message is like, ERROR: Ulfius - Error MHD_start_daemon, aborting When I change port number to other value, it's running well. There is no process use 80. Could you tell me what I should do to use 80 for port number? I need it because I can't use other port number for firewall reason. Thank you for your help in advance.

babelouest commented 5 years ago

Hello @hmkim123 ,

In POSIX systems, you can't listen to ports below 1024 as a non-root user.

You have several ways to achieve this but they're not Ulfius related.

For example, you can redirect connections from port 80 to another port in your firewall, use CAP_NET_BIND_SERVICE or authbind. In my case, I use apache mod_proxy_http to achieve this.

There are several solutions on the internet, you will probably find yours.

hmkim123 commented 5 years ago

Hello @babelouest , Thanks for your advice. Have a nice day.