Add nginx config to serve static files. (#422)

* Add config to serve static files.

* Remove non useful comments

* More minor change
This commit is contained in:
Abhilash Raj
2021-01-17 10:09:51 -08:00
committed by GitHub
parent fa9cb4fd54
commit 061623336f

View File

@@ -211,6 +211,7 @@ password, plese follow the "Forgot Password" link on the "Sign In" page.
To configure the mailman-web container to send emails, add this to your To configure the mailman-web container to send emails, add this to your
`settings_local.py`.: `settings_local.py`.:
``` ```
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = '172.19.199.1' EMAIL_HOST = '172.19.199.1'
@@ -284,9 +285,6 @@ server configuration.
See [the nginx configuration][17] as an example. See [the nginx configuration][17] as an example.
This command will do several things, most importantly: This command will do several things, most importantly:
- Run a wsgi server using [`uwsgi`][7] for the Mailman's Django-based web - Run a wsgi server using [`uwsgi`][7] for the Mailman's Django-based web
@@ -479,17 +477,20 @@ header when you proxy the requests from your Web Server. In Nginx you can do
that by adding the following to your configuration: that by adding the following to your configuration:
``` ```
# Nginx configuration. # Nginx configuration.
location /static {
alias /opt/mailman/web/static;
autoindex off;
}
location / {
# First attempt to serve request as file, then
location / {
proxy_pass http://172.19.199.3:8000; proxy_pass http://172.19.199.3:8000;
include uwsgi_params; include uwsgi_params;
uwsgi_read_timeout 300; uwsgi_read_timeout 300;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
} }
``` ```
@@ -511,15 +512,17 @@ are generally included in the distro packages.
To move to uwsgi protocol in the above nginx configuration use this To move to uwsgi protocol in the above nginx configuration use this
``` ```
# Nginx configuration. # Nginx configuration.
location /static {
location / { alias /opt/mailman/web/static;
# First attempt to serve request as file, then autoindex off;
}
location / {
uwsgi_pass 172.19.199.3:8080; uwsgi_pass 172.19.199.3:8080;
include uwsgi_params; include uwsgi_params;
uwsgi_read_timeout 300; uwsgi_read_timeout 300;
} }
``` ```
Please make sure that you are using v0.1.1 or greater if you use this configuration. Please make sure that you are using v0.1.1 or greater if you use this configuration.
@@ -567,7 +570,7 @@ fi
exit 0 exit 0
``` ```
Please do not forget to make the script executable (chmod +x certbot-renew.sh). **Please do not forget to make the script executable (`chmod +x certbot-renew.sh`).**
LICENSE LICENSE
======= =======