I try to migrate my backend website (containing API service to mobile apps) from LAMP into docker platform. currently this docker split into 3 parts (Laravel App, database & nginx). sofar, the website launch successfully without error.
However, I need base URL to be like below:
http://backend.example.com/public/
so, if i want to login, url will be http://backend.example.com/public/login
, also API url with above format like http://backend.example.com/public/api/v1
What I have tried:
- Set
APP_URL
value in.env
tohttp://backend.example.com/public/
- Set below setting in
config/app.php
to:
'url' => env('APP_URL', 'https://backend.example.com/public'),
'asset_url' => env('ASSET_URL', null)
- run
php artisan route:clear
andphp artisan migrate
but still not successfull, evertime i launch web browser, url still stuck to:
http://backend.example.com/
http://backend.example.com/login/
http://backend.example.com/api/v1/
etc
any idea to overcome above problem?
===Additional Note
- nginx conf for nginx docker:
server {
listen 80;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/public;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
}
}
-
original base URL in LAMP are
http://backend.example.com/public/
, in original i'm using LAMP (Apache+PHP+MySQL) but in current Docker I'm using (Nginx + MySQL + php:7.4-fpm), however because an error, i change something so original base url cannot be achieved anymore... -
Reference of This Migration can be found here.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire