Skip to content

Commit

Permalink
proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaofeng1227 committed Oct 26, 2023
1 parent c746950 commit 5eb9f38
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docker/proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# modify time: 202310251750, you can modify here to trigger Docker Build action
# modify time: 202310261640, you can modify here to trigger Docker Build action
# from Dockerfile: https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/docker/Dockerfile
# from image: https://hub.docker.com/r/jc21/nginx-proxy-manager

Expand Down
29 changes: 24 additions & 5 deletions docker/proxy/config/initproxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,30 @@ server {
}
}

location /apidocs/ {
proxy_pass http://websoft9-apphub:8080/docs;
sub_filter 'src="/static' 'src="/apidocs/static';
sub_filter 'spec-url="/' 'spec-url="/apidocs/openapi.json';
}
location /apidocs/ {
proxy_pass http://websoft9-apphub:8080/docs;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
sub_filter 'spec-url="/apidocs/openapi.json' 'spec-url="/openapi.json';
}

location /static/ {
proxy_pass http://websoft9-apphub:8080/static/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location = /openapi.json {
proxy_pass http://websoft9-apphub:8080/openapi.json;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location /media/ {
proxy_pass http://websoft9-apphub:8081/images/;
Expand Down
6 changes: 5 additions & 1 deletion docker/proxy/s6/w9init/migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ set +e

nginx_proxy(){

if [ ! -f /data/nginx/proxy_host/initproxy.conf ] || [ $(stat -c %Y /etc/shadow) -ge $(stat -c %Y /data/nginx/proxy_host) ]
current_time=$(date +%s)
shadow_modified_time=$(stat -c %Y /etc/shadow)
time_difference=$((current_time - shadow_modified_time))

if [ ! -f /data/nginx/proxy_host/initproxy.conf ] || [ $time_difference -le 60 ]
then
cp /etc/initproxy.conf /data/nginx/proxy_host/
echo "Update initproxy.conf to Nginx"
Expand Down

0 comments on commit 5eb9f38

Please sign in to comment.