CentOS 7 nginx部署及ssl配置

80端口部署
proxy_pass反向代理至127.0.0.1:7001
root为页面入口路径
server_name填写域名

server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  domain.com www.domain.com;
    root   /home/client/;
    location / {
    	try_files $uri $uri/  /index.html;
    }
    location /api {
        proxy_pass http://127.0.0.1:7001;
    }
}

ssl配置
rewrite配置自动跳转https
ssl_certificate ssl_certificate_key 配置对应ssl证书秘钥

server
    {
    listen       80;
    #listen       [::]:80 default_server;
    server_name  jingangtui.top www.jingangtui.top;
    rewrite ^(.*)$ https://$host$1 permanent;
  
    }    
    
  server
{
    listen 443 ssl;
    server_name jingangtui.top www.jingangtui.top;
    ssl_certificate  /www/wwwroot/sxxxx.pem;
    ssl_certificate_key /www/wwwroot/sxxxx.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;
    root   /home/client/;
    location / {
    	try_files $uri $uri/  /index.html;
    }
    location /api {
    	
        proxy_buffer_size  128k;
        proxy_buffers   32 32k;
        proxy_busy_buffers_size 128k;
        proxy_pass http://127.0.0.1:7001;
    }
     access_log  /www/wwwlogs/access.log;
}      

你可能感兴趣的:(nodejs,nginx)