Skip to content

help for nginx config with --base-href command (I am not sure it's a bug) #4045

Closed
@fsx999

Description

@fsx999

Please provide us with the following information:

OS?

Linux Ubuntu

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:
angular-cli: 1.0.0-beta.25.5
node: 6.3.1
os: darwin x64
@angular/common: 2.4.3
@angular/compiler: 2.4.3
@angular/core: 2.4.3
@angular/forms: 2.4.3
@angular/http: 2.4.3
@angular/platform-browser: 2.4.3
@angular/platform-browser-dynamic: 2.4.3
@angular/router: 3.4.3
@angular/compiler-cli: 2.4.3

Hi. This is not a bug request, but I need help pour config my nginx server.

In the same server and the same url I have two applications: first at / is a django application
et second at /example is my angular app created with angular-cli.

I want serve my angular app at /example.

this is my nginx config

 location /example/ {
    alias /pwd/myapp/dist/;

    try_files $uri$args $uri$args/  /index.html;



}
location / {

     proxy_pass http://localhost:8000/;
     proxy_redirect     off;
     proxy_set_header   Host             $host;
     proxy_set_header   X-Real-IP        $remote_addr;
     proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
     proxy_set_header   X-Forwarded-Protocol "http";

}

my build command : ng build -bh example

The js file is finding by my browser but the router crash :
the redirect url is /example/example instead of /example/ and of course it doesn't work.

I search everywhere but i don't find any documentation about this.

Thanks for your help.

(sorry for my bad english)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions