Jump to content

How to make url of laravel app under docker without “public”?


mstdmstdd

Recommended Posts

Hello,
Installing laravel 5.7 app under docker(based on php:7.2-apache ) I need to use "/public" in my url to run my app, so root url of my app is

http://127.0.0.1:8081/public

I modified .env of my laravel app as

APP_URL=http://127.0.0.1:8081/public/


But it did not help, as I browser I got image url :

http://127.0.0.1:8081/storage/votes/-vote-16/Babe_ver1.jpg?dt=1546059015

which way is invalid, as valid way must be :

http://127.0.0.1:8081/public/storage/votes/-vote-16/Babe_ver1.jpg?dt=1546059015

The similar way with ajax requests, as I got invalid ways :

http://127.0.0.1:8081/admin/get_activity_log_rows/1

But valid must be 

http://127.0.0.1:8081/public/admin/get_activity_log_rows/1


In my docker-compose.yml :

version: '3.1'

services:

    web:

        build:
            context: ./web   
            dockerfile: Dockerfile.yml
        
        environment:
            - APACHE_RUN_USER=www-data
        volumes:
            - ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
        ports:
            - 8081:80
        working_dir: ${APP_PTH_CONTAINER}


    composer:
        image: composer:1.8
        volumes:
            - ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
        working_dir: ${APP_PTH_CONTAINER}
        command: composer install 

        
and in .env of docker project :

# PATHS
DB_PATH_HOST=./databases
APP_PATH_HOST=./Votes
APP_PTH_CONTAINER=/var/www/html/

       
How to set root url  of my site with “/public” ?

       
Thanks!
 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.