. Net Core Deployment Centos7+nginx

Source: Internet
Author: User

First-Burst diagram

Because it is a beginner, the deployment of this interface is not easy, before the first step to get a this out

Dynamic no problem, and then static resources are not come out, got two hours without results, with regrets slept a sleep

Test 1:

server {   a;    / {   /usr/myweb/wwwroot/;   Proxy_pass http://localhost:5000; # just set the address port   1.1;   Proxy_set_header Upgrade $http _upgrade;   Proxy_set_header Connection Keep-alive;   Proxy_set_header Host $host;   Proxy_cache_bypass $http _upgrade;  }             

Viewing results 404

Test 2:

server {   a;    /usr/myweb/wwwroot/;    / {   proxy_pass http:///localhost:5000; # just set the address port   1.1;   Proxy_set_header Upgrade $http _upgrade;   Proxy_set_header Connection Keep-alive;   Proxy_set_header Host $host;   Proxy_cache_bypass $http _upgrade;  }             

View the results or 404

Because those who deploy. NET core on-line success seem to have not encountered the same situation, do not know what is going on, look at a lot of articles have no results

After the change of thinking, since. NET core does not, then check other Nginx+apache, Tomcat these, as long as the agent forwarding should have this situation?

Sure enough, I saw the word: static and dynamic resource separation, OK check the direction of things, because obviously my. NET core host is obviously unable to locate the static resources

Otherwise it will not get out of the way, then the dynamic and static resources separately processing should be possible, and then found this figure

Nginx-location Configuration Guide

Https://www.server110.com/nginx/201402/6372.html

I also wrote a paragraph

server {  a;   ~.* (js|css| svg) $ {      /usr/myweb/wwwroot/;  }   / {  proxy_pass http:///localhost:5000; # just set the address port  1.1;  Proxy_set_header Upgrade $http _upgrade;  Proxy_set_header Connection Keep-alive;  Proxy_set_header Host $host;  Proxy_cache_bypass $http _upgrade;  }}

With a full of expectations to check again, the static resources to point a bit, hey, this js why is empty

Not to be able to deal with JS, no, you have to look at this file first

Oh, the original is an empty JS, the perfect solution.

Master don't squirt, younger brother Linux plus. NET Core Novice

. Net Core Deployment Centos7+nginx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.