vendredi 28 décembre 2018

How url of laravel app under docker without "public"?

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/mysites/-mysite-16/Babe_ver1.jpg?dt=1546059015

which way is invalid, as valid way must be :

http://127.0.0.1:8081/public/storage/mysites/-mysite-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=./Mysites
APP_PTH_CONTAINER=/var/www/html/

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

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire