What if Vue fails to access static resources after being deployed to a Linux server?

Alibaba cloud Q & A 2022-02-13 07:34:17 阅读数:793

vue fails access static resources

Vue + Express project Deployed to Linux Static resources cannot be accessed after the server . vue.config.js Set up :

The absolute path is set at the beginning , no way , After changing to a relative path, it still doesn't work . image.png

Node Express :

image.png

Catalog :

image.png

Nginx:

image.png

Report errors :

image.png

When accessing the server, you can get the information of the page title , But you can't get static resources .

There is no problem when running locally , But deploy to Linux That's it on the server




Take the answer 1:

Hello! ,

app.use('/css', express.static(assets +'/css'));app.use('/js', express.static(assets +'/js'));

copyright:author[Alibaba cloud Q & A],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130734154446.html