docker-gen icon indicating copy to clipboard operation
docker-gen copied to clipboard

Redirect tomcat app to port 443 in a subroute

Open Absant94 opened this issue 2 years ago • 0 comments

Hi!

Im use to develop server in the classic way, but since the last year I started to do this with Docker.

The thing, is that I cant connect my tomcat container to a subroute.

Ex: MY_IP => this shows my wordpress website in port 80 MY_IP/app => here I want to show my tomcat app

Usually I did this with mod_jk in apache, but someone recommend me to use this library. And after try to do this for two weeks I cant find the way.

Is possible with ngix-proxy?

This is my docker-compose.yml

version: 3.1
services:


    wordpress:
        image: wordpress:php7.1-apache
        expose: 
            - 80
        restart: always
       
        environment:
            WORDPRESS_DB_HOST: mysql
            WORDPRESS_DB_USER: root
            WORDPRESS_DB_PASSWORD: somewordpress
            WORDPRESS_DB_NAME: wordpress   
        volumes:
        - ./html:/var/www/html:rw
        - ./Dockerfiles/wordpressapache/Dockerfile:/var/www/html:rw
    #    - ./confapache:/etc/apache2:rw
        links:
        - mysql:mysql
        environment:
            VIRTUAL_HOST: MY_IP
    mysql:
        image: mysql:latest
        ports: 
            - 3306:3306
        restart: always
        command: --default-authentication-plugin=mysql_native_password
        environment:
            MYSQL_ROOT_PASSWORD: somewordpress
            MYSQL_DATABASE: wordpress
            MYSQL_USER: wordpress
            MYSQL_PASSWORD: wordpress
        volumes:
            - ./mysql-data:/var/lib/mysql
            - ./mysqlbase:/docker-entrypoint-initdb.d        
    tomcat:
        container_name: miproyecto-tomcat
        image: tomcat:jre8-openjdk
        ports:
            - 8080:8080
        restart: always
        volumes:
            - ./tomcat/app.war:/usr/local/tomcat/webapps/app.war

        links:
            - mysql:mysql

            
    nginx-proxy:
        container_name: nginx_proxy
        image: jwilder/nginx-proxy:latest
        restart: always
        ports:
            - 80:80           
        volumes:
            - /var/run/docker.sock:/tmp/docker.sock:ro

Absant94 avatar Jul 02 '22 18:07 Absant94