1

I am trying to deploy an Angular2 application on a NGINX web-server.

I have used webpack to bundle my application and got a dist folder.

I was hoping that I would place the dist folder on my linux VM that hosts NGINX webserver and update the nginx.conf file to serve static content from that dist folder.

But when I change the root location in the server property of the configuration file below, I get a HTTP 403 Forbidden on accessing the default page on NGINX

server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  _;
    root         /home/dist;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
    }

    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
}

Please note that when I run NGINX, it runs using the root user. And the new folder where I kept the dist folder, I gave it 777 permission.

sunny arya
  • 213
  • 2
  • 5
  • 20
  • Possible duplicate of this - https://stackoverflow.com/questions/42489459/serving-an-angular2-cli-built-app-using-nginx-throws-404-403/49463104#49514871 – viks May 08 '18 at 10:06

0 Answers0