nginx证书配置

原创
2022/07/07 17:45
阅读数 20


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    client_max_body_size 10M;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;
      root   /data/dist/;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;


    location / {

    alias  /data/dist/;

            try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404

           index  index.html index.htm;
        charset utf-8;
         
           proxy_redirect off;

          proxy_set_header Host $http_host;
         
         
           proxy_set_header X-Real-IP $remote_addr;

         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 

        }

  location /syl/ {
           proxy_pass http://localhost:7080/syl/;
           charset utf-8;
           index  index.html index.htm
           proxy_redirect off;

           proxy_set_header Host $http_host;
           
           proxy_set_header X-Real-IP $remote_addr;

           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        }
 
    
        
   location /login  {
         alias  /data/dist/;
 

        }
  location @router {
            rewrite ^.*$ /index.html last;
        }
      

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

     
    }

 

server {
        listen       443 ssl;
        server_name    localhost;
    
        ssl_certificate      /data/ssl/lee.crt;
        ssl_certificate_key  /data/ssl/lee.key;
    
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
    
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
    

     location / {

       alias  /data/dist/;

            try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404

           index  index.html index.htm;
        charset utf-8;
         
           proxy_redirect off;

          proxy_set_header Host $http_host;
         
         
           proxy_set_header X-Real-IP $remote_addr;

         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 

        }

    location /login  {
         alias  /data/dist/;
 

        }
location @router {
            rewrite ^.*$ /index.html last;
        }
        location /api/admin/payment/callback/wechat {
            #root   html;
            proxy_pass http://localhost:6061/api/admin/payment/callback/wechat/;
            index  index.html index.htm index.php;
        }

 


  location /syl/ {
           proxy_pass http://localhost:7080/syl/;
           charset utf-8;
           index  index.html index.htm
           proxy_redirect off;

           proxy_set_header Host $http_host;
           
           proxy_set_header X-Real-IP $remote_addr;

           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        }
 
    

   

      location /crmebimage {
        alias  /data/image/crmebimage;

    }

 

  }
}

 

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部