nginx - Docker和Spring Boot:如何从URL隐藏端口?

标签 nginx docker spring-boot

我尝试在DigitalOcean上部署我的Spring Boot。我构建了docker镜像并在服务器上运行它,一切都很好(docker run -p 8080:8080 hub_user/docker_image)。我有自己的域和ip地址(我的应用程序的访问URL为myapp.com:8080)。但是,如何隐藏URL中的端口号以访问我的应用程序?没有端口8080的情况下如何使用我的域?

最佳答案

如果您使用的是http(我想),则默认端口为80。因此,如果您编写myapp.com等效于myapp.com:80

docker run -p 80:8080 hub_user/docker_image

关于nginx - Docker和Spring Boot:如何从URL隐藏端口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38208056/

相关文章:

http - 在 Gunicorn 中,如何添加连接 : Close to the response once server shutdown has begun?

nginx - 如何防止谷歌索引我的 https 网址?

python - NGINX 不与 flask rest API 通信。 docker

docker - docker build在jhipster中失败

docker - 使用docker时无法访问phpmyadmin

java - Spring JDBC 中使用 BeanPropertySqlParameterSource 的 SQLSyntaxErrorException

mysql - 表单字段中的文本数据太长

git - 对开发团队的 Codespaces 设置的基数感到困惑

spring - 为什么我的 Spring Web 应用程序项目不能正确运行 Web 和 Thymeleaf 依赖项?

spring - 从 Spring Boot 配置中排除 Java 系统属性和环境变量