nginx.conf 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #user nobody;
  2. worker_processes 1;
  3. #error_log logs/error.log;
  4. #error_log logs/error.log notice;
  5. #error_log 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 logs/access.log main;
  17. sendfile on;
  18. #tcp_nopush on;
  19. #keepalive_timeout 0;
  20. keepalive_timeout 65;
  21. gzip on; #gzip
  22. gzip_min_length 1k;
  23. gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/javascript image/jpeg image/gif image/png;
  24. server {
  25. listen 80;
  26. server_name www.yishasoft.com;
  27. return 301 https://$server_name$request_uri;
  28. }
  29. server {
  30. listen 443 ssl;
  31. listen [::]:443 ssl;
  32. server_name www.yishasoft.com;
  33. ssl_certificate "/var/www/certificate/yishasoft.com.pem";
  34. ssl_certificate_key "/var/www/certificate/yishasoft.com.key";
  35. location /admin/ {
  36. proxy_pass http://127.0.0.1:5000/admin/;
  37. proxy_redirect off;
  38. proxy_set_header Host $host;
  39. proxy_set_header Upgrade $http_upgrade;
  40. proxy_set_header Connection keep-alive;
  41. proxy_set_header X-Real-IP $remote_addr;
  42. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  43. proxy_cache_bypass $http_upgrade;
  44. }
  45. location /api/ {
  46. proxy_pass http://127.0.0.1:5001/api-doc/;
  47. proxy_redirect off;
  48. proxy_set_header Host $host;
  49. proxy_set_header Upgrade $http_upgrade;
  50. proxy_set_header Connection keep-alive;
  51. proxy_set_header X-Real-IP $remote_addr;
  52. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  53. proxy_cache_bypass $http_upgrade;
  54. }
  55. }
  56. # HTTPS server
  57. #
  58. #server {
  59. # listen 443 ssl;
  60. # server_name localhost;
  61. # ssl_certificate cert.pem;
  62. # ssl_certificate_key cert.key;
  63. # ssl_session_cache shared:SSL:1m;
  64. # ssl_session_timeout 5m;
  65. # ssl_ciphers HIGH:!aNULL:!MD5;
  66. # ssl_prefer_server_ciphers on;
  67. # location / {
  68. # root html;
  69. # index index.html index.htm;
  70. # }
  71. #}
  72. }