Чтобы Angular UI работали с nginx, вам нужно загружать index.html для любого URL, где вы иначе вернули бы 404, чтобы позволить маршрутизации работать:
nginx_angular_try_files.conf
location / {
try_files $uri $uri$args $uri$args/ /index.html;
}Полный пример для сайта по умолчанию с API:
nginx_angular_full.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html;
server_name MyServer;
location / {
try_files $uri $uri$args $uri$args/ /index.html;
}
location /api {
proxy_pass http://localhost:8080;
}
}
Check out similar posts by category:
Nginx
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow