Nginx Integration⚓︎
1 Operating Procedure⚓︎
1.1 Edit configuration file⚓︎
vi /etc/nginx/conf.d/jumpserver.conf
1.2 Select method of deployment⚓︎
server {
listen 80;
# server_name _;
client_max_body_size 5000m; # File size limit
# Luna Configuration
location /luna/ {
# Please replace the component names in the template with the actual IP addresses of the services, especially if they are deployed on the local machine
# proxy_pass http://127.0.0.1:4200;
proxy_pass http://luna:4200;
}
# Core data static resource
location /media/replay/ {
add_header Content-Encoding gzip;
root /opt/jumpserver-v3.10.5/data/;
}
location /static/ {
root /opt/jumpserver-v3.10.5/data/;
}
# KoKo Lion Configuration
location /koko/ {
# Please replace the component names in the template with the actual IP addresses of the services, especially if they are deployed on the local machine
# proxy_pass http://127.0.0.1:5000;
proxy_pass http://koko:5000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# lion Configuration
location /lion/ {
# Please replace the component names in the template with the actual IP addresses of the services, especially if they are deployed on the local machine
# proxy_pass http://127.0.0.1:8081;
proxy_pass http://lion:8081;
proxy_buffering off;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_ignore_client_abort on;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 6000;
}
location /ws/ {
# Please replace the component names in the template with the actual IP addresses of the services, especially if they are deployed on the local machine
# proxy_pass http://127.0.0.1:8080;
proxy_pass http://core:8080;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ ^/(core|api|media)/ {
# Please replace the component names in the template with the actual IP addresses of the services, especially if they are deployed on the local machine
# proxy_pass http://127.0.0.1:8080;
proxy_pass http://core:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# Frontend Lina
location /ui/ {
# Please replace the component names in the template with the actual IP addresses of the services, especially if they are deployed on the local machine
# proxy_pass http://127.0.0.1:9528;
proxy_pass http://lina:9528;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location / {
rewrite ^/(.*)$ /ui/$1 last;
}
}
server {
listen 80;
# server_name _;
client_max_body_size 5000m; # File Size limit
# Frontend Lina
location /ui/ {
try_files $uri / /index.html;
alias /opt/lina-v3.10.5/;
expires 24h;
}
# Luna Configuration
location /luna/ {
try_files $uri / /index.html;
alias /opt/luna-v3.10.5/;
expires 24h;
}
# Core data static resource
location /media/replay/ {
add_header Content-Encoding gzip;
root /opt/jumpserver-v3.10.5/data/;
}
location /static/ {
root /opt/jumpserver-v3.10.5/data/;
expires 24h;
}
# KoKo Lion configuration
location /koko/ {
# Please replace the component names in the template with the actual IP addresses of the services, especially if they are deployed on the local machine
# proxy_pass http://127.0.0.1:5000;
proxy_pass http://koko:5000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# lion configuration
location /lion/ {
# Please replace the component names in the template with the actual IP addresses of the services, especially if they are deployed on the local machine
# proxy_pass http://127.0.0.1:8081;
proxy_pass http://lion:8081;
proxy_buffering off;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_ignore_client_abort on;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 6000;
}
location /ws/ {
# Please replace the component names in the template with the actual IP addresses of the services, especially if they are deployed on the local machine
# proxy_pass http://127.0.0.1:8080;
proxy_pass http://core:8080;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ ^/(core|api|media)/ {
# Please replace the component names in the template with the actual IP addresses of the services, especially if they are deployed on the local machine
# proxy_pass http://127.0.0.1:8080;
proxy_pass http://core:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location / {
rewrite ^/(.*)$ /ui/$1 last;
}
}
nginx -t
nginx -s reload