Press "Enter" to skip to content

「nginx」配置静态网站访问

  • Nginx 配置静态网站访问

支持 HTTP 和 HTTPS。

server {
    listen 443 ssl;
    server_name idoubi.cc; 

    ssl_certificate  /etc/nginx/certs/idoubi.cc.crt; 
    ssl_certificate_key /etc/nginx/certs/idoubi.cc.key; 
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    location / {
        root /data/code/idoublog/public;
        index index.html index.htm;
    }

    error_log /etc/nginx/logs/idoubi.cc.error;
}

server {
    listen 80;
    server_name idoubi.cc; 
    
    return 301 https://$host$request_uri; 
}