1

I am trying to deploy Angular 5 application Digital Ocean Ubuntu 16.4 Nginx. But Angular application is not working properly from there.

I am able to do below:

http:://ipaddress/api/values http://domainname/api/values

But website for angular is not working:

http://domainname http://ipaddress

I tried several combination to access the application but it did not work for me.

You can see the below default file for nginx:

server {
        listen 80 default_server;
        listen [::]:80 default_server;
        location / {
                proxy_pass http://localhost:5000;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection keep-alive;
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }
        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

#       root /var/www/html;
        root /home/xxxx/www;


        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

#       server_name _;

#       location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
#               try_files $uri $uri/ =404;
        #       proxy_pass http://localhost:4200;
        #}
}

With this default file I have done with multiple location but again it didn't work.

Can you please tell me how do I deploy Angular application running along with dotnetcore 2.1 api.

1 Answer 1

1

Somehow in dotnet app.UseStaticFiles(); was commented. I removed the comments and yeah it started working.

Sign up to request clarification or add additional context in comments.

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.