beyondcode / herd-community

76 stars 1 forks source link

[Bug]: nginx fails to start in port 80 #848

Closed powlam closed 2 weeks ago

powlam commented 2 months ago

Platform

Windows

Operating system version

Windows 11 Pro (23H2, 22631.3737)

System architecture

Windows

Herd Version

1.8.0

PHP Version

No response

Bug description

My company doesn't allow to reuse the port 80 for localhost, so I need to change that port for Herd's Nginx.

When I started working with Herd 2 months ago I changed the port at ~/.config/herd/config/nginx/herd.conf:

server {
    listen 127.0.0.1:8070 default_server;

But since the last update of Herd, something seems to have changed because now everytime Herd launches the Nginx service is "red".

... bind() to 127.0.0.1:80 failed ...

It seems that Nginx is ignoring my configuration and tries to use the port 80.

Thanks.

Steps to reproduce

No response

Relevant log output

... [emerg] 9352#14612: bind() to 127.0.0.1:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)
powlam commented 1 month ago

I haven't changed anything but today it is working on the port configured in herd.conf, so I will close this bug. Anyway I think it would be a good improvement to allow changing the nginx port from the UI, so I'll create another request for it.

ElenaRgC commented 1 month ago

I'm experiencing the same issue.

I can't use port 80 either so I manually changed the port in ~/.config/herd/config/nginx/herd.conf too and was able to work with different PHP versions by modifying their own config files to use the same port.

But today I updated to the last Herd version and it stopped working, same error as the original issue:

2024/07/04 11:50:12 [emerg] 23360#15416: bind() to 127.0.0.1:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)

I checked again herd.conf to verify that the new port wasn't removed by the update, but it was still there. Even so, Nginx is trying to connect to port 80.

mechelon commented 1 month ago

Do you have any secured/isolated sites? Those could have individual configuration files, that still use port 80.

While you can manually modify the port in your config files, Herd is currently not designed for this and some parts might break by changing the port.

powlam commented 1 month ago

Sometimes it fails, sometimes it works... I don't know what's happening but something is still not working properly when the port of Nginx is modified into herd.conf.

powlam commented 1 month ago

Do you have any secured/isolated sites? Those could have individual configuration files, that still use port 80.

While you can manually modify the port in your config files, Herd is currently not designed for this and some parts might break by changing the port.

Thank you for answering. In every single site that is served with Herd I've also modified the port number (in the files located at ~/.config/herd/config/valet/Nginx). They are not secured.

Some projects are using PHP 8.3 (the default one for my configuration), but others are using 8.1 and 7.4.

I know that I shouldn't modify those files manually, but as I can't use the port 80 and Herd does not allow yet to change it properly I'm afraid I have no other choice... (or is there another option? please, brighten my day ;)

powlam commented 1 month ago

It is also required to edit the port in the file ~/.config/herd/config/pro/nginx/adminer.conf

But this is not as easy as the other files, because it seems that Herd regenerates the file every time the services are started.

There must be an official way of changing the port number(s), please...

ElenaRgC commented 1 month ago

It is also required to edit the port in the file ~/.config/herd/config/pro/nginx/adminer.conf

But this is not as easy as the other files, because it seems that Herd regenerates the file every time the services are started.

There must be an official way of changing the port number(s), please...

It sure works, thank you! A bit messy to have the need to rewrite the file every time I open Herd, we do need a way to change the port with the GUI.

mpociot commented 2 weeks ago

I created an internal issue to potentially change the nginx port, but this is not supported as of right now. Herd is an opinionated development setup where we use port 80.