lundi 22 mai 2017

Nginx : the rule( location = / ) in server context do not work

server
{
    server_name www.vanging.com;
    root /web/sites/vanging.com/;

    include modules/general.conf;
    include modules/ssl.conf;

    ssl_certificate certs/http://ift.tt/2q2O72c;
    ssl_certificate_key certs/http://ift.tt/2qOpWl4;

    error_log /web/sites/http://ift.tt/2q2ZeIE debug;
    access_log /web/sites/http://ift.tt/2qOJ0jv;

    location = /
    {
        root /web/sites/vanging.com/www;
    }

}

---------------------------
in modules/general.conf:

listen  80;
index   index.html;
add_header Access-Control-Allow-Origin * ;

---------------------------
in modles/ssl.conf:
listen                      443 http2;
ssl                         on;

# Perfect_Forward_Security,Diffie-Hellman
ssl_dhparam                 dhparam.pem;

ssl_session_cache           shared:SSL:1m;
ssl_session_timeout         5m;
ssl_ciphers                 ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:AES256-GCM-SHA384:DES-CBC3-SHA;
ssl_prefer_server_ciphers   on;
ssl_protocols               TLSv1 TLSv1.1 TLSv1.2;
ssl_stapling                on;
ssl_stapling_verify         on;

# http-->https
if ($server_port = 80)
{
    return 301 https://$server_name$request_uri;
}

if ($scheme = http)
{
    return 301 https://$server_name$request_uri;
}

error_page 497 https://$server_name$request_uri;

add_header  Strict-Transport-Security "max-age=15768000; includeSubDomains; preload";

In the config above,I want to put the homepage of my site in the www dir of the document root,but the rule location = / just have no any effect to the incoming request with the url https://www.vanging.com.

Anyone can help ?

Thanks !




Aucun commentaire:

Enregistrer un commentaire