【发布时间】:2017-09-25 12:15:50
【问题描述】:
我正在处理 https://serversforhackers.com/video/letsencrypt-for-free-easy-ssl-certificates 和 https://certbot.eff.org/docs/intro.html ,试图向我的网站添加一个 ssl 证书(ubuntu 16.04 上的 nginx 上的 django 1.8)。我希望能够从我的服务器提供测试页面。我的 nginx 文档根目录位于 /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 有 2 个配置文件。第一个是默认的,具有以下位置块:
location ~ /.well-known {
allow all;
}
location ~ /.well-known/acme-challenge/ {
allow all;
}
第二个是:
# 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;
}
我希望能够通过以下方式提供测试页面:
http://example.com/test.html
相反,我得到了上面的屏幕截图。如何配置 nginx 或 django 以允许提供测试页面?
【问题讨论】:
-
这与“允许所有”指令没有任何关系。其余的配置在哪里,特别是为 Django 服务的别名?
-
我已经在上面添加了完整的文件。
标签: python django ubuntu nginx