天天看点

Nginx常用配置

worker_processes 1;

events {

worker_connections 1024;

}

http {

server_names_hash_bucket_size 64;

include mime.types;

default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

server {
    listen       443;
    server_name  A域名;
    ssl on;
    ssl_certificate C:/hnlw/nginx-1.18.0/ssl/证书.pem;
    ssl_certificate_key C:/hnlw/nginx-1.18.0/ssl/证书.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    location / {
	 proxy_pass http://服务器IP:8081;
    }

    
}

server {
    listen       80;
    server_name  B域名;
    rewrite ^/(.*)$ https://B域名:443/$1 permanent;
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
       #这里是前端打包后存放的文件路径  linux要存放到服务器 home文件夹下
        #root   C:/hnlw/nginx/nginx-1.18.0/html/jjhpc;
        root   html;
    }
  
}
           
}
           
}