2

I'm trying to deploy my AngularJS app generated with Yoeman on Nginx, this is my nginx configuration :

server {
    server_name 0.0.0.0;
    listen 8080;
    root /home/gestAngular/app;
    index index.html;

    location / {
        try_files $uri $uri/ /index.html;
    }
}

but when i start nginx, my app dosent find the dependencies.

my directory gestAngular look like this :

-gestAngular

  ---App

  ---bower_components

  ---node_modules

  ---test

  ---dist

its generated with yoeman angular generator .

Any idea how can i make nginx recognize the location of my dependencies (bower-components)?

1
  • What is the URI of the dependencies? Commented Jan 5, 2016 at 21:16

2 Answers 2

6

It doesn't find the dependencies because you have set the root folder to the folder app, which won't get access to the bower components.

Instead you should "build" your app using gulp or grunt to the dist folder and deploy that folder to your server:

root /home/gestAngular/dist;
Sign up to request clarification or add additional context in comments.

Comments

2

you have this 'dist' folder which was generated by command 'grunt build' or 'grunt' this folder you have to deploy directly you don't have to deploy other files if you have generated your project using yeoman you will get a file name index.html. This file you have to configure in nginx.

server {
    server_name 0.0.0.0;
    listen 8080;
     location / {
        root   YourDistFolderLocation/dist;
        index  index.html index.htm;
    }
}

by doing this your frontend should be up & running let me know if any problem comes. I hope it helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.