nginx.conf 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. server {
  2. listen 80;
  3. server_name example.com www.example.com;
  4. root /home/jiaciwang/Code/tmp/you_thinkjs/www;
  5. set $node_port 8360;
  6. index index.js index.html index.htm;
  7. if ( -f $request_filename/index.html ){
  8. rewrite (.*) $1/index.html break;
  9. }
  10. if ( !-f $request_filename ){
  11. rewrite (.*) /index.js;
  12. }
  13. location = /index.js {
  14. proxy_http_version 1.1;
  15. proxy_set_header X-Real-IP $remote_addr;
  16. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  17. proxy_set_header Host $http_host;
  18. proxy_set_header X-NginX-Proxy true;
  19. proxy_set_header Upgrade $http_upgrade;
  20. proxy_set_header Connection "upgrade";
  21. proxy_pass http://127.0.0.1:$node_port$request_uri;
  22. proxy_redirect off;
  23. }
  24. location = /development.js {
  25. deny all;
  26. }
  27. location = /testing.js {
  28. deny all;
  29. }
  30. location = /production.js {
  31. deny all;
  32. }
  33. location ~ /static/ {
  34. etag on;
  35. expires max;
  36. }
  37. }
  38. ## http/2 nginx conf
  39. # server {
  40. # listen 80;
  41. # server_name example.com www.example.com;
  42. # rewrite ^(.*) https://example.com$1 permanent;
  43. # }
  44. #
  45. # server {
  46. # listen 443 ssl http2 fastopen=3 reuseport;
  47. # server_name www.thinkjs.org thinkjs.org;
  48. # set $node_port 8360;
  49. #
  50. # root /home/jiaciwang/Code/tmp/you_thinkjs/www;
  51. #
  52. # keepalive_timeout 70;
  53. #
  54. # ssl_certificate /path/to/certificate;
  55. # ssl_certificate_key /path/to/certificate.key;
  56. # ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  57. # ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA";
  58. # ssl_prefer_server_ciphers on;
  59. # # openssl dhparam -out dhparams.pem 2048
  60. # ssl_dhparam /path/to/dhparams.pem;
  61. #
  62. # ssl_session_cache shared:SSL:10m;
  63. # ssl_session_timeout 10m;
  64. #
  65. # ssl_session_ticket_key /path/to/tls_session_ticket.key;
  66. # ssl_session_tickets on;
  67. #
  68. # ssl_stapling on;
  69. # ssl_stapling_verify on;
  70. # ssl_trusted_certificate /path/to/startssl_trust_chain.crt;
  71. #
  72. #
  73. # add_header x-Content-Type-Options nosniff;
  74. # add_header X-Frame-Options deny;
  75. # add_header Strict-Transport-Security "max-age=16070400";
  76. #
  77. # index index.js index.html index.htm;
  78. # if ( -f $request_filename/index.html ){
  79. # rewrite (.*) $1/index.html break;
  80. # }
  81. # if ( !-f $request_filename ){
  82. # rewrite (.*) /index.js;
  83. # }
  84. # location = /index.js {
  85. # proxy_http_version 1.1;
  86. # proxy_set_header X-Real-IP $remote_addr;
  87. # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  88. # proxy_set_header Host $http_host;
  89. # proxy_set_header X-NginX-Proxy true;
  90. # proxy_set_header Upgrade $http_upgrade;
  91. # proxy_set_header Connection "upgrade";
  92. # proxy_pass http://127.0.0.1:$node_port$request_uri;
  93. # proxy_redirect off;
  94. # }
  95. #
  96. # location = /production.js {
  97. # deny all;
  98. # }
  99. #
  100. # location = /testing.js {
  101. # deny all;
  102. # }
  103. #
  104. # location ~ /static/ {
  105. # etag on;
  106. # expires max;
  107. # }
  108. #}