@
flynaj @
loveyu 纯小白,刚才写成 curl -l 了,应该是 curl -I.
http
HTTP/1.1 200 OK
Server: nginx/1.4.6 (Ubuntu)
Date: Wed, 14 Dec 2016 14:46:53 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 7996
Connection: keep-alive
Cache-Control: no-cache
https
HTTP/1.1 302 Moved Temporarily
Server: nginx/1.4.6 (Ubuntu)
Date: Wed, 14 Dec 2016 14:48:01 GMT
Content-Type: text/html
Content-Length: 169
Connection: keep-alive
Location:
http://www.domain.com/重新设置为 302 了,目前依旧无法正常访问。
@
lslqtz 方法没用,加了,加在 proxy_set_header X-Real-IP $remote_addr;下面了,还不行。。。
目前设置:
server {
listen 80;
server_name
domain.com www.domain.com;
if ($host != '
www.domain.com')
{
rewrite ^/(.*)$
http://www.domain.com/$1 redirect;
}
proxy_cache_valid 301 1m;
location / {
proxy_pass http://127.0.0.1:8000/;
limit_req zone=one burst=20 nodelay;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
add_header Cache-Control no-cache;
}
location /static {
alias /var/www/domain/static;
}
}
server {
listen 443 ssl;
server_name
domain.com www.domain.com;
proxy_cache_valid 301 1m;
rewrite ^/(.*)$
http://www.domain.com/$1 redirect;
ssl_certificate /etc/letsencrypt/live/
domain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/
domain.com/privkey.pem;}