Already changed the nginx web port, but run app still use default url with port 80 #8554

Closed
opened 2026-02-21 18:26:18 -05:00 by yindo · 5 comments
Owner

Originally created by @FlankerZzzz on GitHub (Feb 23, 2025).

Self Checks

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

Dify version

0.15.3 (build with docker compose)

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Hi
I've Already changed the nginx web port.
Also, i can visit DIFY with my new port(make sure my cfg is right)
But, when i click 'run app', its still use default url with port 80, i have to add my port to the url manually, in every time.

✔️ Expected Behavior

how to make the app port bind with nginx port?
than i dont need to add it manually in every time.

here is the env config

Docker Compose Service Expose Host Port Configurations

------------------------------

EXPOSE_NGINX_PORT=43980
EXPOSE_NGINX_SSL_PORT=44980

Actual Behavior

No response

Originally created by @FlankerZzzz on GitHub (Feb 23, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [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 this 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. ### Dify version 0.15.3 (build with docker compose) ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Hi I've Already changed the nginx web port. Also, i can visit DIFY with my new port(make sure my cfg is right) But, when i click 'run app', its still use default url with port 80, i have to add my port to the url manually, in every time. ### ✔️ Expected Behavior how to make the app port bind with nginx port? than i dont need to add it manually in every time. here is the env config # Docker Compose Service Expose Host Port Configurations # ------------------------------ EXPOSE_NGINX_PORT=43980 EXPOSE_NGINX_SSL_PORT=44980 ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:26:18 -05:00
yindo closed this issue 2026-02-21 18:26:18 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 23, 2025):

Hey @FlankerZzzz! 👋 I'm here to help you with any bugs, questions, or contributions you have for the DIFY project. Let's get this issue sorted out together!

I found a similar issue where users experienced the same problem with the 'run app' feature not reflecting the updated Nginx port. The solution involves ensuring that the EXPOSE_NGINX_PORT environment variable is correctly set and that the application code uses this variable to construct the URL.

To resolve this, you can modify the code in index.tsx to include the port in the URL. Here's a suggested solution:

  1. Update the code in index.tsx to construct the URL with the port:

    const appBaseURLWithPort = `${appDetail.site.app_base_url}:${process.env.EXPOSE_NGINX_PORT}`;
    const appUrl = `${appBaseURLWithPort}/${getWebAppType(appDetail.mode)}/${appDetail.site.access_token}`;
    
  2. Ensure that the EXPOSE_NGINX_PORT environment variable is set in your .env file:

    EXPOSE_NGINX_PORT=43980
    

This should ensure that the 'run app' button generates the correct URL with the port included [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Feb 23, 2025): <!-- Greeting --> Hey @FlankerZzzz! 👋 I'm here to help you with any bugs, questions, or contributions you have for the DIFY project. Let's get this issue sorted out together! <!-- Answer --> I found a similar issue where users experienced the same problem with the 'run app' feature not reflecting the updated Nginx port. The solution involves ensuring that the `EXPOSE_NGINX_PORT` environment variable is correctly set and that the application code uses this variable to construct the URL. To resolve this, you can modify the code in `index.tsx` to include the port in the URL. Here's a suggested solution: 1. Update the code in `index.tsx` to construct the URL with the port: ```tsx const appBaseURLWithPort = `${appDetail.site.app_base_url}:${process.env.EXPOSE_NGINX_PORT}`; const appUrl = `${appBaseURLWithPort}/${getWebAppType(appDetail.mode)}/${appDetail.site.access_token}`; ``` 2. Ensure that the `EXPOSE_NGINX_PORT` environment variable is set in your `.env` file: ```plaintext EXPOSE_NGINX_PORT=43980 ``` This should ensure that the 'run app' button generates the correct URL with the port included <sup>[[1]](https://github.com/langgenius/dify/issues/7761)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/dafc7e98-37dd-4f42-95da-b6de7754c53b?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/dafc7e98-37dd-4f42-95da-b6de7754c53b?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/dafc7e98-37dd-4f42-95da-b6de7754c53b?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/dafc7e98-37dd-4f42-95da-b6de7754c53b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/dafc7e98-37dd-4f42-95da-b6de7754c53b?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/dafc7e98-37dd-4f42-95da-b6de7754c53b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/dafc7e98-37dd-4f42-95da-b6de7754c53b?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Feb 24, 2025):

Please tell me what did you changed? Also this is a duplicated question, please search existing issue including closed ones to resolve your problem.

@crazywoola commented on GitHub (Feb 24, 2025): Please tell me what did you changed? Also this is a duplicated question, please search existing issue including closed ones to resolve your problem.
Author
Owner

@king121456 commented on GitHub (Feb 24, 2025):

修改.env文件里的APP_WEB_URL参数
APP_WEB_URL=http://ip:port

@king121456 commented on GitHub (Feb 24, 2025): 修改.env文件里的APP_WEB_URL参数 `APP_WEB_URL=http://ip:port`
Author
Owner

@FlankerZzzz commented on GitHub (Feb 24, 2025):

修改.env文件里的APP_WEB_URL参数 APP_WEB_URL=http://ip:port

感谢,这个可以,改完重新generate新yaml,然后重建就ok了 :D
thanks work for me,regenerate the new yaml and rebuild docker will solved this! :D

@FlankerZzzz commented on GitHub (Feb 24, 2025): > 修改.env文件里的APP_WEB_URL参数 `APP_WEB_URL=http://ip:port` 感谢,这个可以,改完重新generate新yaml,然后重建就ok了 :D thanks work for me,regenerate the new yaml and rebuild docker will solved this! :D
Author
Owner

@sanpatricky commented on GitHub (Mar 5, 2025):

Modify .env then recreate the nginx container:
NGINX_PORT=3010
EXPOSE_NGINX_PORT=3010

@sanpatricky commented on GitHub (Mar 5, 2025): Modify .env then recreate the nginx container: NGINX_PORT=3010 EXPOSE_NGINX_PORT=3010
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8554