Unable to access virtual host domain by name docker apache – a lamp stack application

Site can be accessible by localhost:8100 and 127.0.0.1:8100 but unable to access by myapp.dev
I’m struggling to access by name and try continuesily from 2 day.

Please note: Its on docker desktop windows 10

I’ll be thank full to help in this issue.

My docker-compose.yml

version: '3'

services:
  db:
    image: mysql:${MYSQL_VERSION}
    container_name: db
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    ports:
      - "9906:3306"
  web:
    build:
      context: './.docker/phpApache/'
      args:
        PHP_VERSION: ${PHP_VERSION}
    container_name: php_web
    environment:
      - VIRTUAL_HOST=myapp.dev
      - VIRTUAL_PORT=8100

    depends_on:
      - db
    volumes:
      - ./site/:/var/www/site/
      - ./.docker/phpApache/vhost/000-default.conf:/etc/apache2/sites-enabled/000-default.conf
      #- ./.docker/phpApache/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
    ports:
      - "${APACHE_HTTP_PORT}:80"
    stdin_open: true
    tty: true

My Vhost file

<VirtualHost *:80>
    ServerName myapp
    ServerAlias myapp.dev

    DocumentRoot /var/www/site/public
    <Directory /var/www/site/public>
        AllowOverride None
        Order Allow,Deny
        Allow from All

        FallbackResource /index.php
    </Directory>
    <Directory /var/www/site/public/bundles>
        FallbackResource disabled
    </Directory>
    
</VirtualHost>

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *