This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

nginx

This replaced Apache’s Web Server as the go-to after 2010 and is still in the top spot.

1 - Let's Encrypt Proxy

When you’re proxying a back-end server that’s making let’s encrypt challenges for it’s own purposes, you need a webroot to handle those requests.

vi /etc/nginx/conf.d/some.server.org.conf


#
# Redirect requests for the site that are unencrypted, except for let's encrypt challenges
#
server {
        listen 80;
        server_name some.your.org;

        location / {
                return 301 https://$host$request_uri;
        }

        # Allow access to the ACME Challenge for Let's Encrypt
        location ^~ /.well-known/acme-challenge {
            allow all;
            root /var/www/some.your.org/htdocs;
        }
}
server {
        listen 443 ssl;
...
...

2 - WebDAV on Alpine

With nginx, WebDAV is only available in edge. (or at least it was in 2018 or so)

sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories
apk update;apk upgrade

Then you can install nginx and the htpasswd too

apk add nginx-mod-http-dav-ext 
apk add apache2-utils

htpasswd -c /etc/nginx/conf.d/passwords user1

sudo mkdir /var/lib/nginx/tmp/
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # Try some media
        location /video/ {
                alias /srv/media/video/;
                autoindex on;
                dav_ext_methods   PROPFIND OPTIONS;
		auth_basic "Authentication Required";
		auth_basic_user_file /etc/nginx/conf.d/passwords;
        }
}