我遇到了给定错误的问题:Apache ASP.Net Core Connection Refused AH00957
我已经在安装了 apache2 的 Pi 上安装了 Ubuntu Server 21.04
,并将我的静态 IP 指向该服务器。当我通过 IP(或 dns,因为我将其指向 IP)进入网站时,它正在工作并显示 Apache2 默认页面。
在同一台服务器上,我用 VirtualHost、单独的文件夹和所有内容创建了另一个网站,将另一个 DNS 指向它,它也可以正常工作(我用简单的 html 交换了默认的 apache2 页面,说“嗨”,所以我知道第二个 DNS 被植根于第二个网站)。毕竟,我按照说明为 .NET 5 应用程序设置了 apache,但我很难得到这个错误。
这里有一些我认为可能很重要的信息:
daemon file
(如果我说错了请纠正我)
[Unit]
Description=Running ASP.NET Core on Ubuntu 21.04 Webserver APACHE
[Service]
WorkingDirectory=/var/www/eadresa
ExecStart=/usr/bin/dotnet /var/www/eadresa/Termodom.dll
Restart=always
RestartSec=10
KillSignal=SIGINT
SysLogIdentifier=dotnet-example
User=eadresa
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMENTRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
Virtual Host file
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
ServerName eadresa.rs
ServerAlias *.eadresa.rs
ServerAdmin office@eadresa.rs
DocumentRoot /var/www/eadresa/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteCond ${HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond ${HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /[.*] ws://127.0.0.1:5000/$1 [P]
</VirtualHost>
dotnet --info
Host (useful for support);
Version: 5.0.7
commit: 556582d964
.NET SDKs installed:
No SDKs were found.
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.7 [/home/ubuntu/aspnetcore-64/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.7 [/home/ubuntu/aspnetcore64/shared/Microsoft.NETCore.App]
lsof -i:80
不返回任何内容
apache2 -v
Server Version: Apache/2.4.46 (Ubuntu)
Server built: 2021-03-09T00:45:35
sudo apachectl configtest
返回 Syntax OK