Closed dreamfly999 closed 1 year ago
Hey @dreamfly999,
In the docker-compose configuration file (docker-compose.yml), the nginx port configuration is defined as follows:
(...)
nginx:
image: nginx:alpine
ports:
- "${APP_PORT:-80}:80"
(...)
${APP_PORT:-80}:80
means that the host port which is defined by the environment variable APP_PORT
is mapped to the port 80 in the container. If APP_PORT is not set, 80 is used as a default option (that's what {APP_PORT:-80}
means).
There are multiple ways to set the port (in this example, we set it to 8080):
1) Set the environment variable directly: APP_PORT=8080 docker-compose up --build -d
.
2) Set the environment variable in the .env
file: Just add a line that states APP_PORT=8080
.
3) Directly define the port in docker-compose.yml: Replace - "${APP_PORT:-80}:80"
with - "8080:80"
.
I hope this helps! Have a nice day! Otto
Edit: For future reference, I have added these instructions to the Wiki.
Ok, very clear answer, Thanks for your reply
Thank you for your work. It's really great. At present, I have deployed this website to my local server, but I want to configure another port number, how to do it?