Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App port no change after change the EXPOSE_NGINX_PORT #6505

Closed
5 tasks done
tiomfree opened this issue Jul 21, 2024 · 4 comments
Closed
5 tasks done

App port no change after change the EXPOSE_NGINX_PORT #6505

tiomfree opened this issue Jul 21, 2024 · 4 comments
Labels
🙏 help wanted Extra attention is needed

Comments

@tiomfree
Copy link

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).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.14

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I can access and create app via the new port & URL after changed the port number in .env file:

HTTP port

NGINX_PORT=8056

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

Docker Compose Service Expose Host Port Configurations

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

EXPOSE_NGINX_PORT=8056

For example: http://192.168.50.144:8056/

but the new APP can not access when publish as I find the access URL keep default 80 port no change when I click the publish and "Run App" button.
For example:
The published App URL keeps as below so can't access at all:
http://192.168.50.144/chat/ssflXZpobXQo4JDlWd

it works if I change the port to 8056 as below manually:
http://192.168.50.144:8056/chat/ssflXZpobXQo4JDlWd

✔️ Expected Behavior

Expect the port of new App should be changed from default 80 as well when changed the nginx port in .ENV.
for example: when create new APP, and click the publish and "Run App" button.
http://192.168.50.144:8056/chat/ssflXZpobXQo4JDlWd

❌ Actual Behavior

the published App URL keeps as default 80 port as below so can't access at all:
http://192.168.50.144/chat/ssflXZpobXQo4JDlWd

@dosubot dosubot bot added the 🐞 bug Something isn't working label Jul 21, 2024
Copy link

dosubot bot commented Jul 21, 2024

@tiomfree Hello there! I'm here to help you with your bug report. I'm a bot that can assist with bug resolution, answer questions, and help you become a contributor. Let's work together to solve your issue while we wait for a human maintainer.

To ensure that the published app URL in Dify version 0.6.14 reflects the custom port specified in the .env file instead of defaulting to port 80, you need to modify the NEXT_PUBLIC_API_PREFIX and NEXT_PUBLIC_PUBLIC_API_PREFIX environment variables in your .env.local file to include the custom port.

For example, if your custom port is 8056, you should set:

NEXT_PUBLIC_API_PREFIX=http://192.168.50.144:8056/console/api
NEXT_PUBLIC_PUBLIC_API_PREFIX=http://192.168.50.144:8056/api

Additionally, ensure that your Docker Compose setup reflects the custom port configuration. You can do this by editing the .env file in the dify/docker directory and then restarting the Docker containers:

  1. Navigate to the dify/docker directory:

    cd dify/docker
  2. Edit the .env file to include your custom port settings. Specifically, set the DIFY_PORT variable to your custom port:

    DIFY_PORT=8056
  3. Restart the Docker containers:

    docker compose down
    docker compose up -d

This will ensure that the URLs generated by the application will use the specified custom port [1][2][3].

To continue talking to Dosu, mention @dosu.

@tiomfree
Copy link
Author

I don't think it works with the two items, are you sure it's defined?
NEXT_PUBLIC_API_PREFIX=http://192.168.50.144:8056/console/api
NEXT_PUBLIC_PUBLIC_API_PREFIX=http://192.168.50.144:8056/api

Copy link

dosubot bot commented Jul 21, 2024

The variables NEXT_PUBLIC_API_PREFIX and NEXT_PUBLIC_PUBLIC_API_PREFIX are indeed defined and should be used to ensure the published app URL uses the custom port. Here are the steps to ensure they are correctly set:

  1. Edit the .env.local file:
    Ensure you have a .env.local file in your project directory with the following content:

    NEXT_PUBLIC_API_PREFIX=http://192.168.50.144:8056/console/api
    NEXT_PUBLIC_PUBLIC_API_PREFIX=http://192.168.50.144:8056/api
  2. Update the Docker Compose configuration:
    Make sure your docker-compose.yml file reflects the custom port configuration. For example:

    services:
      web:
        ports:
          - "8056:80"
  3. Restart Docker containers:
    After making these changes, restart your Docker containers to apply the new configuration:

    docker compose down
    docker compose up -d
  4. Verify the environment variables:
    Ensure that the environment variables are correctly loaded by checking the running containers:

    docker compose exec web env | grep NEXT_PUBLIC

By following these steps, the published app URL should use the custom port 8056 instead of the default port 80 [1][2].

To continue talking to Dosu, mention @dosu.

@crazywoola
Copy link
Member

This variable doesn't related to the feature you would like to change. You should read this doc instead.

@crazywoola crazywoola added 🙏 help wanted Extra attention is needed and removed 🐞 bug Something isn't working labels Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙏 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants