i have simple docker-compose file
version: '3.4'
services:
nginx:
image: nginx:1.17
ports:
- "80:80"
- "443:443"
- "5173:5173"
environment:
- TZ=Europe/Moscow
volumes:
- ./docker/nginx/config:/etc/nginx/conf.d
- ./files/logs/nginx:/var/log/nginx/
- ./files/src:/var/www/crm
links:
- "php:php"
mysql:
image: mysql:5.7
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=db
- TZ=Europe/Moscow
volumes:
- ./files/db:/var/lib/mysql
- ./docker/mysql/config:/etc/mysql/conf.d
# command: --sql_mode='NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' #STRICT_TRANS_TABLES
php:
build: ./docker/php
environment:
- TZ=Europe/Moscow
volumes:
- ./files/src:/var/www/crm
links:
- mysql
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8091:80
environment:
- TZ=Europe/Moscow
depends_on:
- mysql
links:
- mysql:db
installed laravel 11 and breeze
when i run npm run build
vite compliles app.js and app.css successfullly
but when i try to run npm run dev
it starts but on browser console i got errors
GET http://lara.crm/resources/css/app.css net::ERR_ABORTED 404 (Not Found)
dashboard:15
GET http://lara.crm/@vite/client net::ERR_ABORTED 404 (Not Found)
dashboard:15
GET http://lara.crm/resources/js/app.js net::ERR_ABORTED 404 (Not Found)
it tries to get files from resources folder which unavailable
(in nginx i have root lara.crm/public)
here is vite config
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/js/app.js',
],
refresh: true,
}),
],
server: {
host: 'lara.crm',
port: 80,
},
build: {
// outDir: './public/build', // Adjust this path according to your setup
},
});
how to make npm run dev
work?
Thanks
i suppose open access to resources folder is not a correct way to resolve a problem.
Probably npm run dev
should work “out of box” if i use artisan serve
server but how to make it work on custom nginx+php-fpm server?
volkoff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.