How do I serve an Angular project from a sub-directory of public_html?

Discussão em 'Angular' iniciado por John Marquez, Fevereiro 12, 2025.

  1. John Marquez

    John Marquez Guest

    I have so far only served finished Angular projects in public_html by running ng build, then copying the output, in my local /dist directory, directly into public_html on my server.

    I want to serve an app so it is hidden from the public for a while, in public_html/mysecretdirectory/ so I can navigate to www.example.com/mysecretdirectory and demo my work in progress. When I copy the local /dist into public_html/mysecretdirectory and navigate to that directory on the server, the browser console shows 404 errors:

    GET http://www.example.com/styles.xxxxx.css net::ERR_ABORTED 404 (Not Found)
    GET http://www.example.com/runtime.xxxxx.js net::ERR_ABORTED 404 (Not Found)
    .
    .


    So, it looks like the compiled output is assuming public_html directory for all files. How do I specify that the compiled project lives in a sub-directory of public_html on the server?

    Continue reading...

Compartilhe esta Página