diff options
-rw-r--r-- | Makefile | 17 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | config.def.mk | 5 | ||||
-rw-r--r-- | nginx-example.conf | 34 |
4 files changed, 56 insertions, 3 deletions
@@ -87,6 +87,9 @@ gpigeon: gpigeon-template.cgi link-tmpl-template.cgi $(MAKE) clean ; \ exit 1; \ fi + + + @if [ '${HAS_MAILSERVER}' == '1' ]; then \ printf "Local mail server setup. ${BOLD}Mail::Sendmail module will be used to send the mails${STOP}.\n"; \ else \ @@ -126,6 +129,10 @@ gpigeon: gpigeon-template.cgi link-tmpl-template.cgi fi @sed -e 's|has_mailserver_goes_here|$(HAS_MAILSERVER)|g' link-tmpl-template.cgi > link-tmpl.cgi @sed -e 's|gpg_homedir_goes_here|$(_GPG_HOMEDIR)|g' link-tmpl-template.cgi > link-tmpl.cgi + @if test -n '$(WWWDOMAIN)' && test -n '$(WWWPREFIX)'; then\ + $(MAKE) nginxconf;\ + printf "Done generating $(WWWDOMAIN).conf for nginx.";\ + fi @printf "\nDone preparing files. You can now type\nsudo make install\nin your terminal.\n" install: @@ -137,12 +144,20 @@ install: install -Dm600 link-tmpl.cgi $(DESTDIR)$(LINK_TEMPLATE_PATH) install -Dm644 index.html favicon.ico styles.css -t $(DESTDIR)$(WWWPREFIX)/ install -Dm755 merci/* -t $(DESTDIR)$(PREFIX)/merci/ + @if test -e '$(WWWDOMAIN).conf'; then\ + printf "\nInstalling $(WWWDOMAIN).conf into $(NGINXCONFDIR)\n";\ + install -Dm644 $(WWWDOMAIN).conf -t $(DESTDIR)$(NGINXCONFDIR);\ + fi +nginxconf: nginx-example.conf + @sed -e 's|wwwpath_goes_here|$(WWWPREFIX)|g;s|domain_goes_here|$(WWWDOMAIN)|g' nginx-example.conf > $(WWWDOMAIN).conf ;\ + + uninstall: rm -rf $(DESTDIR)$(PREFIX) rm -rf $(DESTDIR)$(WWWPREFIX) clean: - rm -f genpass.txt gpg.txt link-tmpl.cgi gpigeon.cgi + rm -f genpass.txt gpg.txt link-tmpl.cgi gpigeon.cgi $(WWWDOMAIN).conf .PHONY: clean install uninstall @@ -94,7 +94,6 @@ server { fastcgi_pass unix:/run/fcgiwrap.sock; include /etc/nginx/fastcgi_params; } - - include errorpages.conf; } ``` +You can also tune the `WWWDOMAIN` and `NGINXCONFDIR` variable in your `config.mk` to have it generated for you when running `make`. diff --git a/config.def.mk b/config.def.mk index 5917230..9c03cd6 100644 --- a/config.def.mk +++ b/config.def.mk @@ -23,3 +23,8 @@ MAILSENDER =# the mailer address that'll send you the encrypted mails MAILSENDER_PW =# password for the mailer address SMTP_DOMAIN =# smtp domain pour the mailer SMTP_PORT =# smtp port for the mailer + +#optional, domain to generate nginx config for +#and where to put the config +WWWDOMAIN= +NGINXCONFDIR=/etc/nginx/sites-enabled diff --git a/nginx-example.conf b/nginx-example.conf new file mode 100644 index 0000000..97e5027 --- /dev/null +++ b/nginx-example.conf @@ -0,0 +1,34 @@ +server { + listen 80; + server_name domain_goes_here; + + location / { + return 301 https://$host$request_uri; + } +} + +server { + listen 443 ssl http2; + + root wwwpath_goes_here; + server_name domain_goes_here; + ssl_certificate /etc/letsencrypt/live/domain_goes_here/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/domain_goes_here/privkey.pem; + error_log /var/log/gpigeon.log; + index index.html index.htm; + + location = /cgi-bin/gpigeon.cgi { + ssi off; + gzip off; + fastcgi_pass unix:/run/fcgiwrap.sock; + include /etc/nginx/fastcgi_params; + } + + location ~ ^/cgi-bin/l/(.*).cgi$ { + ssi off; + gzip off; + fastcgi_pass unix:/run/fcgiwrap.sock; + include /etc/nginx/fastcgi_params; + } +} + |