I have an Angular app and I want to serve it locally using NGINX (on Windows). The app works if I just go to http://localhost
, but I want to serve my app using http://localhost/my/ui
as the base path. This is where I ran out of ideas. I started from this:
server {
listen 80;
server_name localhost;
location / {
root html;
try_files $uri $uri/ index.html;
}
}
I copied the dist folder to the NGINX's html folder to make things easier. The index.html
file looks like this:
<!doctype html>
<html>
<head>
<title>Angular-AngularJS hybrid thingie</title>
<base href="/">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
<body ng-cloak>
<app></app>
<script src="bundle.js"></script>
</body>
</html>
I tried playing around with the location
and base href
, setting one or the other to /my/ui
, or even both, but I just get a 404.