嗨,我正在使用nginx反向代理在CentOS 7上运行dotnet核心。以下是我的配置。
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name freebitcoins.zone www.freebitcoins.zone;
root /usr/share/nginx/html;
ssl_certificate "/home/Ssl/freebitcoins.zone.crt";
ssl_certificate_key "/home/Ssl/freebitcoins.zone.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
autoindex on;
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 $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /websocket/ {
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 $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
server {
listen 80;
listen [::]:80;
server_name freebitcoins.zone www.freebitcoins.zone;
return 301 https://$server_name$request_uri;
}我面临的问题是,它没有加载css或js文件(都是静态的)。

在Asp.net核心日志记录中,我确实得到了以下错误。
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.7387ms 404
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://freebitcoins.zone/web_assets/images/logo.png
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.3727ms 404
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://freebitcoins.zone/favicon.ico
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.5379ms 404请帮助我做错了什么或有什么问题。它已经吃了我的头三天了。
发布于 2019-05-15 05:01:52
我想通了。任何被困在这里的人。事情很简单。
dotnet /home/freeExWeb/freeExWeb.dll &由于某些原因,这将不会加载css或js文件。
但是,如果您从自己的目录运行dotnet进程。沃拉!
cd /home/freeExWeb/
dotnet freeExWeb.dll &https://serverfault.com/questions/906699
复制相似问题