Advertisement
Guest User

Untitled

a guest
Dec 19th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.26 KB | None | 0 0
  1. #user nobody;
  2. worker_processes 1;
  3.  
  4. #error_log logs/error.log;
  5. #error_log logs/error.log notice;
  6. #error_log logs/error.log info;
  7.  
  8. #pid logs/nginx.pid;
  9.  
  10.  
  11. events {
  12. worker_connections 1024;
  13. }
  14.  
  15.  
  16. http {
  17. include mime.types;
  18. default_type application/octet-stream;
  19. #access_log logs/access.log main;
  20. charset UTF-8;
  21. sendfile on;
  22. tcp_nopush on;
  23. tcp_nodelay on;
  24. keepalive_timeout 30;
  25.  
  26. # 开启gzip压缩
  27. gzip on;
  28. gzip_vary on;
  29. gzip_comp_level 6;
  30. gzip_buffers 16 8k;
  31. gzip_min_length 1000;
  32. gzip_proxied any;
  33. gzip_disable "msie6";
  34. gzip_http_version 1.0;
  35. gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
  36.  
  37. # server {
  38. # listen 80 ;
  39. # # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
  40. # return 301 https://$host$request_uri;
  41. # }
  42.  
  43. # 缓存
  44. proxy_cache_path /usr/local/nginx_cache/blog/proxy_cache_pathlevels=1:2 keys_zone=pnc:300m inactive=7d max_size=10g;
  45. proxy_temp_path /usr/local/nginx_cache/blog/proxy_temp_path;
  46. proxy_cache_key $host$uri$is_args$args;
  47.  
  48. server {
  49. listen 80 ;
  50. listen 443 ssl ;
  51. # listen 443 443 ssl http2 fastopen=3 reuseport;
  52.  
  53. server_name www.example.com example.com;
  54.  
  55. server_tokens off;
  56.  
  57. ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
  58. ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem;
  59. ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
  60.  
  61.  
  62.  
  63. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  64.  
  65.  
  66. ssl_prefer_server_ciphers on;
  67. ssl_session_cache shared:SSL:10m;
  68. ssl_session_timeout 30m;
  69.  
  70. ssl_session_tickets on;
  71. ssl_stapling on;
  72. ssl_stapling_verify on;
  73. if ($host != 'www.example.com' ) {
  74. rewrite ^/(.*)$ https://www.example.com/$1 permanent;
  75. }
  76.  
  77. location / {
  78. proxy_http_version 1.1;
  79. add_header Strict-Transport-Security "max-age=31536000";
  80. add_header X-Frame-Options deny;
  81. add_header X-Content-Type-Options nosniff;
  82. resolver 127.0.0.1;
  83. proxy_cache pnc;
  84. proxy_cache_valid 200 304 2h;
  85. proxy_cache_lock on;
  86. proxy_cache_lock_timeout 5s;
  87. proxy_cache_use_stale updating error timeout invalid_header http_500 http_502;
  88. proxy_ignore_headers Set-Cookie;
  89.  
  90. # proxy_set_header Host www.example.com;
  91. # proxy_set_header X-Real-IP $remote_addr;
  92. # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  93.  
  94.  
  95. proxy_pass http://example.com:8088 ;
  96. }
  97. }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement