Project

General

Profile

[Solved] Change port

Added by okoestner almost 6 years ago

I want to let my lighttpd server listen on port 8080. So I configured this in the /etc/lighttpd/lighttpd.conf and restarted the server with service lighttpd restart.
Unfortunately the server is still listening on port 80.
Anything I am missing?


Replies (4)

RE: Change port - Added by gstrauss almost 6 years ago

Anything I am missing?

Details. You're missing details, such as the contents of how you configured "this".

Similar to https://redmine.lighttpd.net/boards/2/topics/8090 it's more than likely that you're doing something wrong.

Check to see if lighttpd actually restarted after you changed the config file, and then check that you have modified the proper config file, i.e. the one used by the running process.

Consider also reading the documentation. By default, lighttpd listens on port 80 unless you configure server.port to something else. If you configured lighttpd to additionally listen on 8080 with $SERVER["socket"] = "*:8080", then lighttpd will additionally listen on port 8080.

RE: Change port - Added by okoestner almost 6 years ago

My lighttpd.conf lokks like this:

server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
)

server.document-root        = "/own/www/dev" 
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log" 
server.pid-file             = "/var/run/lighttpd.pid" 
server.username             = "www-data" 
server.groupname            = "www-data" 
server.port                 = 80

index-file.names            = ( "index.php", "index.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/" 
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
#include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port

include_shell "/usr/share/lighttpd/create-mime.assign.pl" 
include_shell "/usr/share/lighttpd/include-conf-enabled.pl" 

$SERVER["socket"] == "mydomain:8080" {
        server.document-root = "/own/www/mydomain/" 
}

Given that configuration the server will not start. The error file looks like this:

Jul 25 21:33:22 homi01 systemd[1]: Starting Lighttpd Daemon...
Jul 25 21:33:22 homi01 systemd[1]: Started Lighttpd Daemon.
Jul 25 21:33:23 homi01 lighttpd[9724]: 2018-07-25 21:33:22: (network.c.464) can't bind to port: mydomain 8080 Cannot assign requested address
Jul 25 21:33:23 homi01 systemd[1]: lighttpd.service: Main process exited, code=exited, status=255/n/a
Jul 25 21:33:23 homi01 systemd[1]: lighttpd.service: Unit entered failed state.
Jul 25 21:33:23 homi01 systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Jul 25 21:33:23 homi01 systemd[1]: lighttpd.service: Service hold-off time over, scheduling restart.
Jul 25 21:33:23 homi01 systemd[1]: Stopped Lighttpd Daemon.

If I drop the last three lines from the config file (socket...) the server will start properly.

What I want to achieve is that I get a service running on port 80 and one on port 8080. The very best would be if I could log errors to two different files, one for each service.

Aprreciate any help on that.

RE: Change port - Added by gstrauss almost 6 years ago

You are mostly helpless.

> Jul 25 21:33:23 homi01 lighttpd[9724]: 2018-07-25 21:33:22: (network.c.464) can't bind to port: mydomain 8080 Cannot assign requested address

Read the doc. Docs_Configuration "mydomain" is not an IP address and you're not running a modern version of lighttpd which supports resolving DNS names at startup.

Did you include the version of lighttpd you were running in your question? Of course not. You're mostly helpless. Before posting to this site again, please use your favorite search engine to and read and practice (elsewhere) on how to ask a good technical question.

RE: [Solved] Change port - Added by okoestner almost 6 years ago

I am running version 1.4.45-1 on dietpi v6.12. And the packet manager tells me that this is the latest version. So hopefully my packet manager will soon support the really latest version.

Thanks for your hint regarding missing name resolution and the need for applying an IP address. That fixed that issue.

    (1-4/4)