Skip to content

Commit 0bec4bd

Browse files
committed
hashbang: add nginx template file and systemd unit file
1 parent 3b323aa commit 0bec4bd

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## hashbang nginx user configuration template
2+
## This is a simplified configuration, just to serve ~/Public
3+
4+
worker_processes 1;
5+
error_log stderr;
6+
pid /home/${USER}/.nginx.pid;
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
http {
13+
include /etc/nginx/mime.types;
14+
default_type application/octet-stream;
15+
16+
sendfile on;
17+
18+
keepalive_timeout 65;
19+
20+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
21+
ssl_prefer_server_ciphers on;
22+
access_log stdout;
23+
server {
24+
listen unix:/home/${USER}/.nginx.sock;
25+
server_name ${USER}.de1.hashbang.sh;
26+
27+
location / {
28+
root /home/${USER}/Public;
29+
}
30+
}
31+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Hashbang nginx user service template
2+
3+
[Unit]
4+
Description=A high performance web server and a reverse proxy server
5+
Documentation=man:nginx(8)
6+
7+
[Service]
8+
ExecStartPre=/bin/sh -c '/usr/bin/envsubst < %h/.config/nginx/nginx.conf.template > %h/.config/nginx/nginx.conf'
9+
ExecStartPre=-/usr/bin/rm %h/.nginx.sock
10+
ExecStart=/usr/sbin/nginx -g 'daemon off; master_process on;' -p %h/.config/nginx -c nginx.conf
11+
ExecStartPost=-/usr/bin/rm %h/.nginx.sock
12+
Restart=always
13+
14+
[Install]
15+
WantedBy=default.target

0 commit comments

Comments
 (0)