我在前端使用vue-cli,在后端使用Laravel
这是我的Nginx配置:-
server{
// Here I set up laravel in root project
listen 80;
root /var/www/html/serverside/public;
index index.php index.html index.htm;
server_name localhost;
//Here is vuejs project
location / {
root /var/www/html/frontend;
try_files $uri $uri/ = /index.html;
}
//Here is example when I want to use route path in laravel project
location /admin {
try_files $uri $uri/ /index.php?$query_string;
}
}
问题是assets()
在Laravel中重定向到/var/www/html/frontend;
如何在/var/www/html/serverside/public;
中使Laravel中的资产重定向
我尝试做这样的事情:-
// if enter /admin-js I want to read app.js file but it didnt working
location /admin-js {
rewrite ^/admin-js/$ /var/www/html/serverside/public/js/app.js;
try_files $uri $uri/ /index.php?query_string;
}