2023-10-29 03:32:46 +00:00
|
|
|
#!/hint/bash -euE
|
|
|
|
# Copyright (C) 2023 Umorpha Systems
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
|
|
packages+=(nginx)
|
|
|
|
|
2023-11-04 07:12:33 +00:00
|
|
|
post_install+=(20:nginx:post_install) # must be before '30:certbot:post_install'
|
2023-10-29 03:32:46 +00:00
|
|
|
nginx:post_install() {
|
|
|
|
local arg_mountpoint=$1
|
|
|
|
|
|
|
|
cat >"$arg_mountpoint/etc/nginx/nginx.conf" <<-'EOF'
|
|
|
|
# -*- mode: nginx; nginx-indent-level: 4; intent-tabs-mode: nil -*-
|
|
|
|
|
|
|
|
worker_processes 1;
|
|
|
|
|
|
|
|
error_log /var/log/nginx/error.log error;
|
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
|
|
|
error_log /var/log/nginx/http.error.log error;
|
|
|
|
access_log /var/log/nginx/http.access.log combined;
|
|
|
|
|
|
|
|
include mime.types;
|
|
|
|
default_type application/octet-stream;
|
|
|
|
|
|
|
|
sendfile on;
|
|
|
|
keepalive_timeout 65;
|
|
|
|
|
|
|
|
gzip on;
|
|
|
|
|
|
|
|
root /srv/http/$server_name;
|
|
|
|
|
|
|
|
include /etc/nginx/sites/*.conf;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
install -Dm644 /dev/stdin "$arg_mountpoint/etc/nginx/snippets/listen.conf" <<-'EOF'
|
|
|
|
# -*- mode: nginx -*-
|
|
|
|
listen 80;
|
|
|
|
listen [::]:80;
|
|
|
|
|
2023-10-29 07:58:53 +00:00
|
|
|
error_log /var/log/nginx/http.$server_name.error.log error;
|
|
|
|
access_log /var/log/nginx/http.$server_name.access.log combined;
|
2023-10-29 03:32:46 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
systemctl --root="$arg_mountpoint" enable nginx.service
|
|
|
|
}
|