参考文章:https://juejin.cn/post/6844904063688179720#heading-8

    1. upstream halo {
    2. server 127.0.0.1:8090;
    3. }
    4. server {
    5. listen 80;
    6. listen [::]:80;
    7. listen 443 ssl http2;
    8. listen [::]:443 ssl http2;
    9. ssl_certificate /usr/local/nginx/cert/6566010_www.tangwx.site.pem;
    10. ssl_certificate_key /usr/local/nginx/cert/6566010_www.tangwx.site.key;
    11. #ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    12. #ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    13. #ssl_prefer_server_ciphers on;
    14. #ssl_session_timeout 10m;
    15. #ssl_session_cache builtin:1000 shared:SSL:10m;
    16. #ssl_buffer_size 1400;
    17. #add_header Strict-Transport-Security max-age=15768000;
    18. #ssl_stapling on;
    19. #ssl_stapling_verify on;
    20. server_name tangwx.site www.tangwx.site;
    21. access_log /data/wwwlogs/www.tangwx.site_nginx.log combined;
    22. index index.html index.htm index.php;
    23. root /data/wwwroot/www.tangwx.site;
    24. include /usr/local/nginx/conf/rewrite/none.conf;
    25. if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
    26. #error_page 404 /404.html;
    27. #error_page 502 /502.html;
    28. location / {
    29. proxy_set_header HOST $host;
    30. proxy_set_header X-Forwarded-Proto $scheme;
    31. proxy_set_header X-Real-IP $remote_addr;
    32. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    33. proxy_pass http://halo;
    34. }
    35. location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    36. proxy_pass http://halo;
    37. expires 30d;
    38. access_log off;
    39. }
    40. location ~ .*\.(js|css)?$ {
    41. proxy_pass http://halo;
    42. expires 7d;
    43. access_log off;
    44. }
    45. location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|LICENSE|README\.md) {
    46. deny all;
    47. }
    48. }