Reputation: 36317
I'm working through https://serversforhackers.com/video/letsencrypt-for-free-easy-ssl-certificates and https://certbot.eff.org/docs/intro.html , trying to add an ssl certificate to my site (django 1.8 on nginx on ubuntu 16.04). I want to be able to serve a test page from my server. My nginx document root is at /var/www/html.
deploy@server:/var/www$ ll html/
total 40
drwxr-xr-x 3 root root 4096 Apr 26 21:17 ./
drwxr-xr-x 3 root root 4096 Apr 25 16:27 ../
drwxrwxrwx 2 root root 4096 Apr 27 11:16 .well-known/
-rw-r--r-- 1 root root 11321 Jun 21 2016 index.html
-rw-r--r-- 1 root root 612 Feb 6 16:43 index.nginx-debian.html
-rw-r--r-- 1 root root 11321 Apr 26 21:17 test.html
nginx has has 2 config files. The first is default and has the following location block:
location ~ /.well-known {
allow all;
}
location ~ /.well-known/acme-challenge/ {
allow all;
}
The second is:
# configuration file /etc/nginx/sites-enabled/example:
server {
#listen 80;
listen 80 ;
listen [::]:80 ;
listen 443 ssl http2 ;
listen [::]:443 ssl http2 ;
server_name example.org www.example.org;
include snippets/ssl-example.org.conf;
include snippets/ssl-params.conf;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/deploy/example3;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/example.sock;
}
location ~* (?:^|/)\. {
allow all;
}
location ^~ /\.well-known {
allow all;
}
I want to be able to serve the test page by using:
http://example.com/test.html
Instead I get the screenshot above. How can I configure nginx or django to allow the test page to be served?
Upvotes: 1
Views: 96
Reputation: 2923
I think that the problem is not in the nginx configuration, but in the urls.py
configuration. According to the screenshot, you haven't configured the url pattern r'^test.html$'
that would match the URL you're trying to access.
You can find more information about configuring urls in the Django documentation.
Upvotes: 0