nginx.conf 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. user root;
  2. worker_processes 4;
  3. error_log /srv/nginx/logs/error.log;
  4. error_log /srv/nginx/logs/error.log notice;
  5. error_log /srv/nginx/logs/error.log info;
  6. pid logs/nginx.pid;
  7. events {
  8. worker_connections 1024;
  9. }
  10. http {
  11. include mime.types;
  12. default_type application/octet-stream;
  13. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  14. '$status $body_bytes_sent "$http_referer" '
  15. '"$http_user_agent" "$http_x_forwarded_for"';
  16. access_log /srv/nginx/logs/access.log main;
  17. sendfile on;
  18. #tcp_nopush on;
  19. keepalive_timeout 65;
  20. gzip on;
  21. gzip_min_length 1k;
  22. gzip_buffers 4 16k;
  23. gzip_types text/plain application/javascript application/x-javascript text/css application/json text/javascript
  24. proxy_set_header Host $host;
  25. proxy_set_header X-Real-IP $remote_addr;
  26. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  27. proxy_buffering on;
  28. proxy_buffer_size 32k;
  29. proxy_buffers 8 64k;
  30. client_max_body_size 100m;
  31. client_body_buffer_size 1024k;
  32. include /usr/local/nginx/conf/conf.d/*.conf;
  33. }
  34. # app server
  35. upstream appServer {
  36. server 127.0.0.1:8080;
  37. server 127.0.0.1:8081;
  38. }
  39. server {
  40. listen 80;
  41. server_name app.xxx.com;
  42. access_log /srv/nginx/logs/app.log main;
  43. location / {
  44. proxy_pass http://appServer;
  45. proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
  46. }
  47. }
  48. # web server
  49. server {
  50. listen 80;
  51. listen 443 ssl;
  52. server_name xxx.com www.xxx.com;
  53. ssl_certificate cert/www.xxx.com.pem;
  54. ssl_certificate_key cert/www.xxx.com.key;
  55. ssl_session_timeout 5m;
  56. ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
  57. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  58. ssl_prefer_server_ciphers on;
  59. access_log /srv/nginx/logs/www.log main;
  60. location / {
  61. root /srv/html/home/;
  62. try_files $uri $uri/index.html @front;
  63. }
  64. location @front {
  65. root /srv/server/html/;
  66. }
  67. location =/apple-app-site-association {
  68. add_header Content-Type application/json;
  69. alias /srv/html/apple-app-site-association;
  70. }
  71. location =/.well-known/apple-app-site-association {
  72. add_header Content-Type application/json;
  73. alias /srv/html/apple-app-site-association;
  74. }
  75. }