Stop lighttpd listening on port 80

Hi there,

I want to use port 80 for openvpn-connection, but it seems that lighttpd is listening unfortunatelly on this port.
Looking into config I don’t have a server setup to listen on port 80:

server.modules = ( 
)

server.document-root        = "/www"
server.upload-dirs          = ( "/tmp" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
#server.username             = "http"
#server.groupname            = "www-data"

index-file.names            = ( "index.php", "index.html",
                                "index.htm", "default.htm",
                                "index.lighttpd.html" )

static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

# listen on IPv4
$SERVER["socket"] == "192.168.1.1:20003" {
	ssl.engine  = "enable"
	ssl.pemfile = "/etc/ssl/private/<DOMAIN>.pem"
	ssl.ca-file = "/etc/ssl/private/fullchain.crt"
}

$HTTP["scheme"] == "https" {
	# Add  'HTTP Strict Transport Security' header (HSTS) to sites
	setenv.add-response-header  += ( "Strict-Transport-Security" => "max-age=31536000; includeSubDomains" )
}

### Use IPv6 if available
#include_shell "/usr/share/lighttpd/use-ipv6.pl"

#dir-listing.encoding        = "utf-8"
#server.dir-listing          = "enable"

include       "/etc/lighttpd/mime.conf"
include_shell "cat /etc/lighttpd/modules.d/*.load"
include_shell "cat /etc/lighttpd/conf.d/*.conf"

(Shot explanation: as I need 443 for different server I had to uninstall lighttpd-https-cert and therefore shifted HSTS into main config.)

root@Turris_Omnia:~# netstat -nltp | grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      12554/lighttpd

How can I turn off that behaviour?

https://lmddgtfy.net/?q=lighttpd%20port

2 Likes

Solution is to completely remove the conditionals and use server.port = <port> functionality.

Please see my longer response in Foris keeps disappearing ... why? about customizing lighttpd on Turris Omnia.