我仍然不知道为什么我的网页显示
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<main class='container'>
<div class='row'>
<div class='col-sm-12'>
<section id="acc1" class="accordion">
<article class="card">
<header id='hdr1a' class="card-header">
<h5 class="mb-0"><button class="btn btn-block btn-dark collapsed" type="button" data-toggle="collapse" data-target="#col1a" aria-expanded="true" aria-controls="col1a"></button></h5>
</header>
<section id="col1a" class="collapse hide" aria-labelledby="hdr1a" data-parent="#acc1">
<div class="card-body">
<p class='card-text'>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<p class='card-text'>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<footer class='card-footer'>
<section id="acc2" class="accordion">
<article class="card">
<header id='hdr2' class="card-header">
<h5 class="mb-0"><button class="btn btn-block btn-dark collapsed" type="button" data-toggle="collapse" data-target="#col2" aria-expanded="true" aria-controls="col2"></button></h5>
</header>
<section id="col2" class="collapse hide" aria-labelledby="hdr2" data-parent="#acc2">
<div class="card-body">
<p class='card-text'>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<p class='card-text'>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<footer class='card-footer'>
<section id="acc3" class="accordion">
<article class="card">
<header id='hdr3a' class="card-header">
<h5 class="mb-0"><button class="btn btn-block btn-dark collapsed" type="button" data-toggle="collapse" data-target="#col3a" aria-expanded="true" aria-controls="col3a"></button></h5>
</header>
<section id="col3a" class="collapse hide" aria-labelledby="hdr3a" data-parent="#acc3">
<div class="card-body">
<p class='card-text'>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<p class='card-text'>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<footer class='card-footer'>
<section id="acc4" class="accordion">
<article class="card">
<header id='hdr4' class="card-header">
<h5 class="mb-0"><button class="btn btn-block btn-dark collapsed" type="button" data-toggle="collapse" data-target="#col4" aria-expanded="true" aria-controls="col4"></button></h5>
</header>
<section id="col4" class="collapse hide" aria-labelledby="hdr4" data-parent="#acc4">
<div class="card-body">
<p class='card-text'>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<p class='card-text'>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<footer class='card-footer'></footer>
</section>
</article>
</section>
</footer>
</section>
</article>
<article class="card">
<header id='hdr3b' class="card-header">
<h5 class="mb-0"><button class="btn btn-block btn-dark collapsed" type="button" data-toggle="collapse" data-target="#col3b" aria-expanded="true" aria-controls="col3b"></button></h5>
</header>
<section id="col3b" class="collapse hide" aria-labelledby="hdr3b" data-parent="#acc3">
<div class="card-body">
<p class='card-text'>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<p class='card-text'>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<footer class='card-footer'></footer>
</section>
</article>
</section>
</footer>
</section>
</article>
</section>
</footer>
</section>
</article>
<article class="card">
<header id='hdr1b' class="card-header">
<h5 class="mb-0"><button class="btn btn-block btn-dark collapsed" type="button" data-toggle="collapse" data-target="#col1b" aria-expanded="true" aria-controls="col1b"></button></h5>
</header>
<section id="col1b" class="collapse hide" aria-labelledby="hdr1b" data-parent="#acc1">
<div class="card-body">
<p class='card-text'>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<p class='card-text'>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<footer class='card-footer'></footer>
</section>
</article>
</section>
</div>
</div>
</main>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
Nginx仅用作我的Django通道应用程序的代理,该应用程序与daphne一起运行。
Nginx正常运行。
myapp.com redirected you too many times.
达芙妮在127.0.0.1:8001上运行
myapp systemd[1]: Starting A high performance web server and a reverse proxy server...
返回
curl -I http://myapp.com/
curl -I https://myapp.com/
有人知道导致此301错误的原因吗?
Nginx配置文件
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 05 Mar 2019 11:53:39 GMT
Content-Type: text/html
Content-Length: 178
Connection: keep-alive
Location: https://myapp.com/
HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3 (Ubuntu)
Date: Tue, 05 Mar 2019 11:54:43 GMT
Content-Type: text/html
Content-Length: 194
Location: https://myapp.com/
Connection: keep-alive
答案 0 :(得分:0)
我仍然不确定如何完全解决此问题,但是当我取出
return 301 https://$server_name$request_uri;
运行curl -I -L http://www.myapp.com/
我得到
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 05 Mar 2019 13:33:42 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 31 Jan 2017 15:01:11 GMT
Connection: keep-alive
ETag: "5890a6b7-264"
Accept-Ranges: bytes
但是我无法访问页面,因为显然LetsEncrypt会将所有http
重定向到https
,所以我被引回到301错误页面!