homework.jackyu.cn 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. server {
  2. listen 80;
  3. listen [::]:80;
  4. server_name homework.jackyu.cn;
  5. # rewrite ^(.*)$ https://$host$1 permanent;
  6. return 307 https://$server_name$request_uri;
  7. }
  8. server {
  9. listen 443 ssl http2;
  10. listen [::]:443 ssl http2;
  11. server_name homework.jackyu.cn;
  12. ssl_certificate /etc/nginx/ssl/jackyu.cn/alpha/jackyu.cn_server_cert.pem;
  13. ssl_certificate_key /etc/nginx/ssl/jackyu.cn/alpha/jackyu.cn_key.pem;
  14. root /var/www/homework/frontend;
  15. # Add index.php to the list if you are using PHP
  16. index index.html;
  17. location / {
  18. # First attempt to serve request as file, then
  19. # as directory, then fall back to displaying a 404.
  20. index index.html;
  21. try_files $uri $uri/ /index.html;
  22. }
  23. location /student {
  24. index manage.html;
  25. try_files $uri $uri/ /student.html;
  26. }
  27. location /teacher {
  28. index manage.html;
  29. try_files $uri $uri/ /teacher.html;
  30. }
  31. location /admin {
  32. index admin.html;
  33. try_files $uri $uri/ /admin.html;
  34. }
  35. location ^~/upload/ {
  36. alias /var/www/homework/api/upload/;
  37. }
  38. include error_json;
  39. location /api/ {
  40. proxy_http_version 1.1;
  41. proxy_set_header Upgrade $http_upgrade;
  42. proxy_set_header Connection upgrade;
  43. proxy_pass http://127.0.0.1:9008/;
  44. proxy_redirect off;
  45. proxy_set_header Host $host;
  46. proxy_set_header X-Real-IP $remote_addr;
  47. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  48. proxy_set_header X-Forwarded-Proto $scheme;
  49. client_max_body_size 1000m;
  50. }
  51. location /zigbee-pi {
  52. alias /var/www/zigbee-pi/frontend/;
  53. index index.html;
  54. }
  55. location /zigbee-pi/api/ {
  56. proxy_http_version 1.1;
  57. proxy_set_header Upgrade $http_upgrade;
  58. proxy_set_header Connection upgrade;
  59. proxy_pass http://127.0.0.1:9200/;
  60. proxy_redirect off;
  61. proxy_set_header Host $host;
  62. proxy_set_header X-Real-IP $remote_addr;
  63. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  64. proxy_set_header X-Forwarded-Proto $scheme;
  65. client_max_body_size 1000m;
  66. }
  67. }