2017-11-07 15 views
0

httpsにnginxリダイレクトを解決しようとしていますが、www.ozkandurakoglu.comを使用すると414 Request-URI Too Largeエラーが発生します。以下はnginxの設定です:django + nginx httpsリダイレクトが表示されます(414 Request-URI Too Large)

upstream ozkan_server { 
    server unix:/home/ytsejam/public_html/ozkansimple/run/gunicorn.sock fail_timeout=10s; 
} 

server { 
    listen 80; 
    server_name ozkandurakoglu.com www.ozkandurakoglu.com; 
    return 301 $scheme:https://ozkandurakoglu.com$request_uri; 
} 
server { 
    listen 443 ssl; 
    listen [::]:443 ssl; 
    ssl on; 
    ssl_certificate /etc/letsencrypt/live/ozkandurakoglu.com/fullchain.pem; 
    ssl_certificate_key /etc/letsencrypt/live/ozkandurakoglu.com/privkey.pem; 
    ssl_trusted_certificate /etc/letsencrypt/live/ozkandurakoglu.com/chain.pem; 
    ssl_session_timeout 1d; 
    ssl_session_cache shared:SSL:50m; 
    ssl_session_tickets off; 
    ssl_prefer_server_ciphers on; 
    add_header Strict-Transport-Security max-age=15768000; 
    ssl_stapling on; 
    ssl_stapling_verify on; 
    server_name www.ozkandurakoglu.com; 
    return 301 $scheme:https://ozkandurakoglu.com$request_uri; 
} 
server { 
    listen 443 ssl; 
    listen [::]:443 ssl; 
    ssl on; 
    ssl_certificate /etc/letsencrypt/live/ozkandurakoglu.com/fullchain.pem; 
    ssl_certificate_key /etc/letsencrypt/live/ozkandurakoglu.com/privkey.pem; 
    ssl_trusted_certificate /etc/letsencrypt/live/ozkandurakoglu.com/chain.pem; 
    ssl_session_timeout 1d; 
    ssl_session_cache shared:SSL:50m; 
    ssl_session_tickets off; 
    ssl_prefer_server_ciphers on; 
    add_header Strict-Transport-Security max-age=15768000; 
    ssl_stapling on; 
    ssl_stapling_verify on; 
    server_name www.ozkandurakoglu.com ozkandurakoglu.com; 
    client_max_body_size 4G; 
    root /home/ytsejam/public_html/ozkansimple/; 
    access_log /home/ytsejam/public_html/ozkansimple/logs/nginx-access.log; 
    error_log /home/ytsejam/public_html/ozkansimple/logs/nginx-error.log warn; 
    large_client_header_buffers 6 16k; 
... 
} 

私を助けてくれますか?

おかげ

+0

であることは、 'も301 $スキーム返す必要があります:// ozkandurakoglu.com $ request_uri'をして' 301を返しません$ scheme:https:// ozkandurakoglu.com $ request_uri' –

+0

それはうまくいかなかった...あなたは他のアイデアを持っていますか? – ytsejam

+0

http://tarunlalwani.com/post/how-to-debug-nginx-reverse-proxy-issues-php-fpm-gunicorn-uwsgi/ –

答えて

1

私は私が私の質問には言及しなかったの両方のnginxとgunicornを変更しなければならなかったので、私は私のサーバーのブロック

server { 
    listen 80; 
    server_name ozkandurakoglu.com www.ozkandurakoglu.com; 
    return 301 https://ozkandurakoglu.com$request_uri; 
} 

$chemeを削除し、

を追加していた私の質問に答えます
limit_request_line 

--limit-request-line INT 
4094 
The maximum size of HTTP request line in bytes. 

私のガンコーンスタートライン。

編集:最終的には正しい設定後の日はここに

server { 
     listen 80; 
     server_name ozkandurakoglu.com www.ozkandurakoglu.com; 
     return 301 https://www.ozkandurakoglu.com$request_uri; 
} 
server { 
    listen 443 ssl http2; 
    server_name ozkandurakoglu.com; 
    return 301 https://www.ozkandurakoglu.com$request_uri; 
} 
server { 
    listen 443 ssl http2; 
    server_name www.ozkandurakoglu.com; 

    access_log /var/log/nginx/ozkandurakoglu.com.access.log; 
    error_log /var/log/nginx/ozkandurakoglu.com.error.log; 

    ssl_certificate   /etc/letsencrypt/live/www.ozkandurakoglu.com/fullchain.pem; 
    ssl_certificate_key  /etc/letsencrypt/live/www.ozkandurakoglu.com/privkey.pem; 
    ssl_trusted_certificate /etc/letsencrypt/live/www.ozkandurakoglu.com/chain.pem; 

    ssl_session_timeout 1d; 
    ssl_session_cache shared:SSL:64m; 
    ssl_session_tickets off; 

    ssl_protocols TLSv1.2; 
    ssl_prefer_server_ciphers on; 
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-$ 
    add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"; 
    ssl_stapling on; 
    ssl_stapling_verify on; 
    add_header X-Frame-Options DENY; 
    add_header X-Content-Type-Options "nosniff" always; 
    add_header X-XSS-Protection "1; mode=block"; 
    add_header Referrer-Policy no-referrer-when-downgrade; 
    #add_header Content-Security-Policy "default-src https:"; 

    resolver 8.8.8.8 8.8.4.4; 
    resolver_timeout 5s; 

    client_max_body_size 4G; 

... }

関連する問題