How to set a domain to ip address and port deploy Spring boot app in docker

  docker, java, spring-boot, ubuntu, webserver

I have VPS with Ubuntu 20.04. I have run a Spring boot Web app in Docker on port 8090. Right now, the website work only with ip address, example

http://12.12.12.12:8090

It’s good.
But not with domain name.

I have domain

firstapp.example.com

I have redirected the domain name to my server’s IP address. And I don’t know what next. I need add someting in appication.properties or change sometiong in apache2?

I have created a new file

/etc/apache2/sites-available/firstapp.example.com.conf

and added

<VirtualHost *:8090>
        ServerName firstapp.example.com
        ServerAlias www.firstapp.example.com

        ServerAdmin [email protected]
        DocumentRoot /home/ubuntu/app/

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

but it’s only give access by 12.12.12.12:8090 to directory.

Source: Docker Questions

LEAVE A COMMENT