The exposed port modified by nginx cannot be accessed normally
huifer opened this issue · 5 comments
What is the bug or the crash?
I modified the nginx port to 8411:80 doc
I checked http://localhost:8411/geoserver The interface message is shown in the figure
I think the redirect address is incorrect
Steps to reproduce the issue
Versions
The version I am using is https://github.com/kartoza/docker-geoserver/tree/v2.23.0
Additional context
docker-compose-nginx.yml
version: '3.9'
volumes:
geoserver-data:
geo-db-data:
services:
db:
image: kartoza/postgis:${POSTGIS_VERSION_TAG}
volumes:
- geo-db-data:/var/lib/postgresql
ports:
- ${POSTGRES_PORT}:5432
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASS=${POSTGRES_PASS}
- ALLOW_IP_RANGE=${ALLOW_IP_RANGE}
- FORCE_SSL=TRUE
restart: on-failure
healthcheck:
test: "PGPASSWORD=${POSTGRES_PASS} pg_isready -h 127.0.0.1 -U ${POSTGRES_USER} -d ${POSTGRES_DB}"
geoserver:
image: kartoza/geoserver:${GS_VERSION}
volumes:
- geoserver-data:/opt/geoserver/data_dir
restart: on-failure
environment:
- GEOSERVER_DATA_DIR=${GEOSERVER_DATA_DIR}
- GEOWEBCACHE_CACHE_DIR=${GEOWEBCACHE_CACHE_DIR}
- GEOSERVER_ADMIN_PASSWORD=geoserver
- GEOSERVER_ADMIN_USER=admin
- INITIAL_MEMORY=${INITIAL_MEMORY}
- MAXIMUM_MEMORY=${MAXIMUM_MEMORY}
depends_on:
db:
condition: service_healthy
healthcheck:
test: "curl --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null -u admin:'geoserver' http://localhost:8080/geoserver/rest/about/version.xml"
interval: 1m30s
timeout: 10s
retries: 3
nginx:
image: nginx
volumes:
- ./sites-enabled:/etc/nginx/conf.d:ro
logging:
driver: json-file
options:
max-size: 200m
max-file: '10'
depends_on:
- geoserver
ports:
- "8411:80"
What should I do if I need to modify the ports exposed by nginx.help me . 🙏🏻🙏🏻🙏🏻
Can you please add https://github.com/kartoza/docker-geoserver#proxy-base-url
docker-compose.yml
version: '3.9'
volumes:
geoserver-data:
geo-db-data:
services:
db:
image: kartoza/postgis:14-3.1
volumes:
- ./geo-db-data:/opt/geoserver/postgresql
ports:
- 32767:5432
environment:
- POSTGRES_DB=gis,gwc
- POSTGRES_USER=admin
- POSTGRES_PASS=admin
- ALLOW_IP_RANGE=0.0.0.0/0
- FORCE_SSL=TRUE
restart: on-failure
healthcheck:
test: "exit 0"
geoserver:
image: kartoza/geoserver:2.21.0
volumes:
- geoserver-data:/opt/geoserver/data_dir
restart: on-failure
environment:
- STABLE_EXTENSIONS=charts-plugin,db2-plugin,mysql-plugin,authkey-plugin
- GEOSERVER_DATA_DIR=/opt/geoserver/data_dir
- GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc
- GEOSERVER_ADMIN_PASSWORD=geoserver
- GEOSERVER_ADMIN_USER=admin
- INITIAL_MEMORY=1G
- MAXIMUM_MEMORY=1G
- HTTP_PROXY_NAME=gis.zen.com
- HTTP_SCHEME=http
depends_on:
db:
condition: service_healthy
healthcheck:
test: "curl --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null -u admin:'geoserver' http://localhost:8080/geoserver/rest/about/version.xml"
interval: 1m30s
timeout: 10s
retries: 3
nginx:
image: nginx
volumes:
- ./sites-enabled:/etc/nginx/conf.d:ro
logging:
driver: json-file
options:
max-size: 200m
max-file: '10'
depends_on:
- geoserver
ports:
- "8411:80"
- nginx config
upstream geoserver {
server geoserver:8080;
}
server {
listen 80;
# the domain name it will serve for
server_name gis.zen.com;
# max upload size, adjust to taste
keepalive_timeout 500;
proxy_connect_timeout 600;
proxy_send_timeout 600;
send_timeout 600;
client_max_body_size 5000;
client_header_timeout 600;
client_body_timeout 600;
fastcgi_read_timeout 300;
location / {
proxy_pass http://geoserver/;
proxy_set_header Host $host; # the host requested by the client
proxy_set_header X-Real-IP $remote_addr; # the real visitor IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # the client IP
proxy_set_header X-Forwarded-Host $host:$server_port; # the host used for the request
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto; # the scheme used for the request, http or https
port_in_redirect off;
proxy_connect_timeout 600;
}
location /geoserver {
proxy_pass http://geoserver/geoserver;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
port_in_redirect off;
proxy_connect_timeout 600;
proxy_set_header X-Script-Name /geoserver;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
local host file
127.0.0.1 gis.zen.com
@NyakudyaA What should I do about it, I've tried so many I just can't handle it. Please help me.
Try to remove this block location /geoserver {}
, or replace to location /geoserver/ {}
,
Not tested , becase of the bad network which prevent me get the image. I tryed so many times.
$ docker compose -f docker-compose-nginx.yml pull
[+] Pulling 24/27
⠋ nginx 7 layers [⣿⣿⣿⣿⣿⣿⣿] 29.15MB/29.15MB Pulling 54.0s
⠹ a378f10b3218 Downloading [==================================================>] 29.15MB/29.15MB 51.2s
✔ 5b5e4b85559a Download complete 48.2s
✔ 508092f60780 Download complete 0.1s
✔ 59c24706ed13 Download complete 1.0s
✔ 1a8747e4a8f8 Download complete 0.2s
✔ ad85f053b4ed Download complete 0.1s
✔ 3000e3c97745 Download complete 0.1s
⠋ db 17 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulling 54.0s
✔ 23a7e2710e02 Download complete 8.5s
✔ 8f3323ec3fc2 Download complete 26.3s
✔ ebf72478baad Download complete 1.4s
✔ b7930cd07694 Download complete 1.3s
✔ a3525653416d Download complete 5.4s
✔ a20550c270bc Download complete 1.3s
✔ 4cc8f1cb35c7 Download complete 2.6s
✔ 8edce23622e6 Download complete 2.7s
✔ a04cef9a7340 Download complete 17.0s
✔ 4f4fb700ef54 Download complete 4.2s
✔ de92a68dda3a Download complete 4.0s
✔ 5276c66e3eca Download complete 6.5s
✔ 67f7ff4fdf2f Download complete 5.5s
✔ 60428a7cb698 Download complete 9.1s
✔ dfff1defba04 Download complete 7.2s
✔ 9fa333da9c2b Download complete 7.8s
✔ 0268c10b19aa Download complete 8.5s
✔ geoserver Pulled 6.5s
unexpected EOF
If your network is preventing you from pulling maybe try building the image yourself