LemmyNet/lemmy-ansible

nginx: add www subdomain & redirect as default

Open

#58 opened on Oct 8, 2022

 (3 comments) (0 reactions) (0 assignees)Jinja (91 forks)auto 404
enhancementhelp wanted

Repository metrics

Stars
 (268 stars)
PR merge metrics
 (PR metrics pending)

Description

NGINX forwarding

It's common to have a server blocks regarding forwarding like this :)

server { listen 80; server_name www.example.com; return 301 http://example.com$request_uri; }

server { listen 80; server_name example.com; ... }

Would be amazing if this could be added to Ansible in order to configure this in nginx automatically. Same applies to HTTPS, right? Also, is it possible to enter subdomains in the Ansible script for gettings certificates via certbot for both, www.example.com as well as example.com itself.

Currently when opening browsing the www. version nginx default page appears. :)

Contributor guide