JumpServer 环境整合

1 操作过程

1.1 编辑配置文件

  1. vi /etc/nginx/conf.d/jumpserver.conf

1.2 选择部署方式

源代码部署使用 Release

  1. server {
  2. listen 80;
  3. # server_name _;
  4. client_max_body_size 5000m; 文件大小限制
  5. # Luna 配置
  6. location /luna/ {
  7. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  8. # proxy_pass http://127.0.0.1:4200;
  9. proxy_pass http://luna:4200;
  10. }
  11. # Core data 静态资源
  12. location /media/replay/ {
  13. add_header Content-Encoding gzip;
  14. root /opt/jumpserver-v3.0.1/data/;
  15. }
  16. location /media/ {
  17. root /opt/jumpserver-v3.0.1/data/;
  18. }
  19. location /static/ {
  20. root /opt/jumpserver-v3.0.1/data/;
  21. }
  22. # KoKo Lion 配置
  23. location /koko/ {
  24. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  25. # proxy_pass http://127.0.0.1:5000;
  26. proxy_pass http://koko:5000;
  27. proxy_set_header X-Real-IP $remote_addr;
  28. proxy_set_header Host $host;
  29. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  30. proxy_http_version 1.1;
  31. proxy_buffering off;
  32. proxy_set_header Upgrade $http_upgrade;
  33. proxy_set_header Connection "upgrade";
  34. }
  35. # lion 配置
  36. location /lion/ {
  37. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  38. # proxy_pass http://127.0.0.1:8081;
  39. proxy_pass http://lion:8081;
  40. proxy_buffering off;
  41. proxy_request_buffering off;
  42. proxy_http_version 1.1;
  43. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  44. proxy_set_header Upgrade $http_upgrade;
  45. proxy_set_header Connection $http_connection;
  46. proxy_ignore_client_abort on;
  47. proxy_connect_timeout 600;
  48. proxy_send_timeout 600;
  49. proxy_read_timeout 600;
  50. send_timeout 6000;
  51. }
  52. # Core 配置
  53. location /ws/ {
  54. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  55. # proxy_pass http://127.0.0.1:8070;
  56. proxy_pass http://core:8070;
  57. proxy_set_header X-Real-IP $remote_addr;
  58. proxy_set_header Host $host;
  59. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  60. proxy_http_version 1.1;
  61. proxy_buffering off;
  62. proxy_set_header Upgrade $http_upgrade;
  63. proxy_set_header Connection "upgrade";
  64. }
  65. location /api/ {
  66. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  67. # proxy_pass http://127.0.0.1:8080;
  68. proxy_pass http://core:8080;
  69. proxy_set_header X-Real-IP $remote_addr;
  70. proxy_set_header Host $host;
  71. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  72. }
  73. location /core/ {
  74. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  75. # proxy_pass http://127.0.0.1:8080;
  76. proxy_pass http://core:8080;
  77. proxy_set_header X-Real-IP $remote_addr;
  78. proxy_set_header Host $host;
  79. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  80. }
  81. # 前端 Lina
  82. location /ui/ {
  83. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  84. # proxy_pass http://127.0.0.1:9528;
  85. proxy_pass http://lina:9528;
  86. proxy_set_header X-Real-IP $remote_addr;
  87. proxy_set_header Host $host;
  88. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  89. }
  90. location / {
  91. rewrite ^/(.*)$ /ui/$1 last;
  92. }
  93. }
  1. server {
  2. listen 80;
  3. # server_name _;
  4. client_max_body_size 5000m; 文件大小限制
  5. # 前端 Lina
  6. location /ui/ {
  7. try_files $uri / /index.html;
  8. alias /opt/lina-v3.0.1/;
  9. expires 24h;
  10. }
  11. # Luna 配置
  12. location /luna/ {
  13. try_files $uri / /index.html;
  14. alias /opt/luna-v3.0.1/;
  15. expires 24h;
  16. }
  17. # Core data 静态资源
  18. location /media/replay/ {
  19. add_header Content-Encoding gzip;
  20. root /opt/jumpserver-v3.0.1/data/;
  21. }
  22. location /media/ {
  23. root /opt/jumpserver-v3.0.1/data/;
  24. }
  25. location /static/ {
  26. root /opt/jumpserver-v3.0.1/data/;
  27. expires 24h;
  28. }
  29. # KoKo Lion 配置
  30. location /koko/ {
  31. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  32. # proxy_pass http://127.0.0.1:5000;
  33. proxy_pass http://koko:5000;
  34. proxy_set_header X-Real-IP $remote_addr;
  35. proxy_set_header Host $host;
  36. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  37. proxy_http_version 1.1;
  38. proxy_buffering off;
  39. proxy_set_header Upgrade $http_upgrade;
  40. proxy_set_header Connection "upgrade";
  41. }
  42. # lion 配置
  43. location /lion/ {
  44. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  45. # proxy_pass http://127.0.0.1:8081;
  46. proxy_pass http://lion:8081;
  47. proxy_buffering off;
  48. proxy_request_buffering off;
  49. proxy_http_version 1.1;
  50. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  51. proxy_set_header Upgrade $http_upgrade;
  52. proxy_set_header Connection $http_connection;
  53. proxy_ignore_client_abort on;
  54. proxy_connect_timeout 600;
  55. proxy_send_timeout 600;
  56. proxy_read_timeout 600;
  57. send_timeout 6000;
  58. }
  59. # Core 配置
  60. location /ws/ {
  61. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  62. # proxy_pass http://127.0.0.1:8070;
  63. proxy_pass http://core:8070;
  64. proxy_set_header X-Real-IP $remote_addr;
  65. proxy_set_header Host $host;
  66. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  67. proxy_http_version 1.1;
  68. proxy_buffering off;
  69. proxy_set_header Upgrade $http_upgrade;
  70. proxy_set_header Connection "upgrade";
  71. }
  72. location /api/ {
  73. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  74. # proxy_pass http://127.0.0.1:8080;
  75. proxy_pass http://core:8080;
  76. proxy_set_header X-Real-IP $remote_addr;
  77. proxy_set_header Host $host;
  78. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  79. }
  80. location /core/ {
  81. # 注意将模板中的组件名称替换为服务实际 ip 地址, 如都在本机部署
  82. # proxy_pass http://127.0.0.1:8080;
  83. proxy_pass http://core:8080;
  84. proxy_set_header X-Real-IP $remote_addr;
  85. proxy_set_header Host $host;
  86. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  87. }
  88. location / {
  89. rewrite ^/(.*)$ /ui/$1 last;
  90. }
  91. }
  1. nginx -t
  1. nginx -s reload