[Why] the old srv-http-result container port is: 20007:11300 when access srv-http-result like: http://$host:20007/result # (without '/' at the end) the nginx will redirect the url to: http://$host:11300/result/ # (with '/' at the end) 11300 is the nginx service listen port, so nginx redirect with this port
[How] keep both ports are same by set LISTEN_PORT with start script. - set LISTEN_PORT to ENV with start script - use $LISTEN_PORT replace default port(11300) form /etc/nginx/conf.d/default.conf(in container) with container starting
Signed-off-by: Lu Weitao luweitaobe@163.com --- container/srv-http/root/sbin/entrypoint.sh | 2 ++ container/srv-http/start-cci | 3 ++- container/srv-http/start-git | 3 ++- container/srv-http/start-initrd | 3 ++- container/srv-http/start-os | 3 ++- container/srv-http/start-pub | 3 ++- container/srv-http/start-result | 3 ++- container/srv-http/start-rpm | 3 ++- 8 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/container/srv-http/root/sbin/entrypoint.sh b/container/srv-http/root/sbin/entrypoint.sh index cd73c7e..ced6eda 100755 --- a/container/srv-http/root/sbin/entrypoint.sh +++ b/container/srv-http/root/sbin/entrypoint.sh @@ -1,4 +1,6 @@ #!/bin/sh
+sed -i "s/listen 11300;/listen $LISTEN_PORT;/g" /etc/nginx/conf.d/default.conf + nginx /usr/sbin/php-fpm7 diff --git a/container/srv-http/start-cci b/container/srv-http/start-cci index 00d8e4c..aa539d2 100755 --- a/container/srv-http/start-cci +++ b/container/srv-http/start-cci @@ -9,7 +9,8 @@ cmd=( docker run --restart=always --name srv-http-cci - -p 20011:11300 + -e LISTEN_PORT=20011 + -p 20011:20011 -v /srv/cci/libvirt-xml:/srv/cci/libvirt-xml:ro -v /etc/localtime:/etc/localtime:ro -d diff --git a/container/srv-http/start-git b/container/srv-http/start-git index c1181a7..0b0ff47 100755 --- a/container/srv-http/start-git +++ b/container/srv-http/start-git @@ -9,7 +9,8 @@ cmd=( docker run --restart=always --name srv-http-git - -p 20010:11300 + -e LISTEN_PORT=20010 + -p 20010:20010 -v /srv/git/archlinux:/srv/git/archlinux:ro -v /etc/localtime:/etc/localtime:ro -d diff --git a/container/srv-http/start-initrd b/container/srv-http/start-initrd index 466ec1b..93be548 100755 --- a/container/srv-http/start-initrd +++ b/container/srv-http/start-initrd @@ -9,7 +9,8 @@ cmd=( docker run --restart=always --name srv-http-initrd - -p 20008:11300 + -e LISTEN_PORT=20008 + -p 20008:20008 -v /srv/initrd/qemu-image:/srv/initrd/qemu-image:ro -v /srv/initrd/dockerimage:/srv/initrd/dockerimage:ro -v /srv/initrd/rpmbuild-pkg:/srv/initrd/rpmbuild-pkg:ro diff --git a/container/srv-http/start-os b/container/srv-http/start-os index d39e04e..5b63902 100755 --- a/container/srv-http/start-os +++ b/container/srv-http/start-os @@ -9,7 +9,8 @@ cmd=( docker run --restart=always --name srv-http-os - -p 20009:11300 + -e LISTEN_PORT=20009 + -p 20009:20009 -v /srv/os:/srv/os:ro -v /etc/localtime:/etc/localtime:ro -d diff --git a/container/srv-http/start-pub b/container/srv-http/start-pub index f42b117..6dfd5a4 100755 --- a/container/srv-http/start-pub +++ b/container/srv-http/start-pub @@ -9,7 +9,8 @@ cmd=( docker run --restart=always --name srv-http-pub - -p 20006:11300 + -e LISTEN_PORT=20006 + -p 20006:20006 -v /srv/pub:/srv/pub:ro -v /etc/localtime:/etc/localtime:ro -d diff --git a/container/srv-http/start-result b/container/srv-http/start-result index bf0287d..32bdf7d 100755 --- a/container/srv-http/start-result +++ b/container/srv-http/start-result @@ -9,7 +9,8 @@ cmd=( docker run --restart=always --name srv-http-result - -p 20007:11300 + -e LISTEN_PORT=20007 + -p 20007:20007 -v /srv/result:/srv/result:ro -v /etc/localtime:/etc/localtime:ro -d diff --git a/container/srv-http/start-rpm b/container/srv-http/start-rpm index 73e5162..2d38298 100755 --- a/container/srv-http/start-rpm +++ b/container/srv-http/start-rpm @@ -9,7 +9,8 @@ cmd=( docker run --restart=always --name srv-http-rpm - -p 20012:11300 + -e LISTEN_PORT=20012 + -p 20012:20012 -v /srv/rpm/pub:/srv/rpm/pub:ro -v /etc/localtime:/etc/localtime:ro -d