Deployment of angular6 production environment

for projects built with angularcli 6.0.2 and nginx as proxy, the js/css file path is 404

.

clipboard.png

clipboard.png
nginx

clipboard.png

clipboard.png
--base-href ./index.htmlbase href./

clipboard.png

clipboard.png

clipboard.png
jshtml 200

clipboard.png

clipboard.png

clipboard.png

clipboard.png

clipboard.png

Mar.22,2021

what you are doing is wrong. You should not use reverse proxies. These are static resources. Why not put them directly in the nginx directory?


solved, use this command: "ng build-- base-href / ng6-ant/-- prod", where 'ng6-ant' is the ID of the agent listening on the server

location /ng6-ant {
            alias  /home/nginx_web/ng6-ant;
            index  index.html index.htm;
            try_files $uri $uri/ /index.html =404;
        }

how to prefix the address for css/js in the index.html code of build with a. / prefix

Menu