.. blogpost:: :title: lighttpd - serve static content - setup :keywords: debian, FTP :date: 2019-09-19 :categories: installation I had to stop relying on friend to hold the content of my website. I wrote earlier a blog on how to setup a SFTP server. Let's now see how to set up a http server with `lighttpd `_. I usually avoid using *python* for this even though it is sometimes more simple because it is easier to detect python processes hanging on. On debian: :: apt-get install lighttpd The configuration is located here: ``/etc/lighttpd/lighttpd.conf``. We let the firewall open port 80: ``sudo ufw allow 80``. Let's add a user for the server: :: useradd -m httpuser passwd httpuser chmod +r -R /home/ftpuser/ftp/web :: server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_accesslog", ) server.document-root = "/home/ftpuser/ftp/web" 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 server.error-handler-404 = "/index404.html" accesslog.filename = "/var/log/lighttpd/access.log" index-file.names = ( "index.php", "index.html", "index.lighttpd.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" Let's activate the service: :: systemctl start lighttpd.service Last step, enable rotating logs. The file ``/etc/logrotate.d/lighttpd`` should look like this: :: { daily missingok copytruncate rotate 365000 compress delaycompress dateformat -%Y-%m-%d dateext notifempty sharedscripts postrotate if [ -x /usr/sbin/invoke-rc.d ]; then \ invoke-rc.d lighttpd reopen-logs > /dev/null 2>&1; \ else \ /etc/init.d/lighttpd reopen-logs > /dev/null 2>&1; \ fi; \ endscript } And restart the service. :: systemctl restart lighttpd.service The folder ``ls /var/log/lighttpd/`` should contain the logs. And to enable *https*: `Setting up a simple SSL configuration `_.