I have one Vue.js app and a REST api which i am hosting with nginx. At / root url there is just a simple index.html page. /api/ has a REST server and /app has vue.js app
My configurations are..
server {
listen 80;
listen 443 ssl;
server_name _;
root /usr/share/backend;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
location / {
index index.html;
}
location /api/ {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://localhost:8080/;
}
location /app {
alias /usr/lib/App/;
try_files /index.html /friendly_404;
}
location /friendly_404 {
return 404 "Sorry, that file could not be found.";
}
error_log /var/log/nginx/vue-app-error.log;
access_log /var/log/nginx/vue-app-access.log;
}
My /api/ server is working without any problem but vue.js /app is not working and on my browser its giving me some like multiple errors like this one below.
GET http://192.168.0.1/js/chunk-d9925106.16c4e8be.js net::ERR_ABORTED 404 (Not Found)
Vue.js Config is..
module.exports = {
// ...other vue-cli plugin options...
publicPath: '/app/',
configureWebpack: {
plugins: [
]
},
productionSourceMap: false,
}
What am I doing wrong here?