Nginx configuration for Angular
Angular is a single-page application (SPA) framework. To serve Angular application using Nginx web server, use following configuration.
1 2 3 4 5 6 7 8 |
server { listen *:80; root /var/www/html; index index.html; location / { try_files $uri$args $uri$args/ /index.html; } } |
You can build static files using the command
1 |
ng build |
Upload the static files it builds, usually in the dist folder to document the root of your website, in this case, /var/www/html
Back to Nginx