How to change the default HTTP port? | 如何修改 默认HTTP端口? #6872

Closed
opened 2026-02-21 18:17:46 -05:00 by yindo · 1 comment
Owner

Originally created by @unsiao on GitHub (Nov 21, 2024).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Provide a description of requested docs changes

I tried modifying the following two options in the .env file, but it didn't work:

# HTTP port
NGINX_PORT=80
# SSL settings are only applied when HTTPS_ENABLED is true
NGINX_SSL_PORT=443
Originally created by @unsiao on GitHub (Nov 21, 2024). ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Provide a description of requested docs changes I tried modifying the following two options in the `.env` file, but it didn't work: ```.env # HTTP port NGINX_PORT=80 # SSL settings are only applied when HTTPS_ENABLED is true NGINX_SSL_PORT=443 ```
yindo closed this issue 2026-02-21 18:17:46 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 21, 2024):

Hello @unsiao! I'm here to help you with any bugs, questions, and contributions you might have. I'm a bot named Dosu, and I'm at your service while you wait for a human maintainer.

I found some relevant discussions and issues regarding changing the default HTTP port in Dify:

  1. Install(signup) page redirected to signin page after changing the default nginx port - This discussion is unsolved and might provide some insights into similar issues [1].

  2. Nginx is listening on port 80 instead of the value of ${NGINX_PORT} that I set in the .env file. - This issue was closed with a solution provided by a pull request to improve Docker Compose settings [2].

To change the default HTTP port, ensure you update the NGINX_PORT variable in your .env file. After making changes to the .env file, you need to restart the Docker Compose services to apply these changes. You can do this by running the following commands in the docker directory:

docker compose down
docker compose up -d

This will stop the running containers and recreate them with the updated environment variables from the .env file [3][4].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 21, 2024): <!-- Greeting --> Hello @unsiao! I'm here to help you with any bugs, questions, and contributions you might have. I'm a bot named [Dosu](https://dosu.dev), and I'm at your service while you wait for a human maintainer. <!-- Answer --> I found some relevant discussions and issues regarding changing the default HTTP port in Dify: 1. [Install(signup) page redirected to signin page after changing the default nginx port](https://github.com/langgenius/dify/discussions/10635) - This discussion is unsolved and might provide some insights into similar issues <sup>[[1]](https://github.com/langgenius/dify/discussions/10635)</sup>. 2. [Nginx is listening on port 80 instead of the value of ${NGINX_PORT} that I set in the .env file.](https://github.com/langgenius/dify/issues/5783) - This issue was closed with a solution provided by a pull request to improve Docker Compose settings <sup>[[2]](https://github.com/langgenius/dify/issues/5783)</sup>. To change the default HTTP port, ensure you update the `NGINX_PORT` variable in your `.env` file. After making changes to the `.env` file, you need to restart the Docker Compose services to apply these changes. You can do this by running the following commands in the `docker` directory: ```bash docker compose down docker compose up -d ``` This will stop the running containers and recreate them with the updated environment variables from the `.env` file <sup>[[3]](https://github.com/langgenius/dify/blob/main/docker/README.md)</sup><sup>[[4]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/getting-started/install-self-hosted/docker-compose.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6872