Web 应用程序在 Linux 中使用 apache 服务器时不显示

发布于 2025-01-11 18:40:07 字数 1538 浏览 0 评论 0原文

我正在尝试使用 dotnet 3.1 和 httpd 2.4 以及代理服务器创建一个 Web 应用程序,但无论配置文件如何,Web 应用程序都不会显示。 我正在使用带有 rhel 7 的 Fabian。 以下是位于文件夹/etc/httpd/conf.d/中的配置文件,

<VirtualHost *:80>  
   ServerName 22.xx.xxx.xx
   ProxyPreserveHost On  
   ProxyPass / http://127.0.0.1:5000/  
   ProxyPassReverse / http://127.0.0.1:5000/  
   RewriteEngine on  
   RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]  
   RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]  
   RewriteRule /(.*) ws://127.0.0.1:5000/$1 [P]  
   ErrorLog /var/log/httpd/netcore-error.log  
   CustomLog /var/log/httpd/netcore-access.log common  
</VirtualHost>  

我的服务文件位于/etc/systemd/system,如下,我必须确保dotnet位置的位置如下它没有安装在标准位置。此外,root 用户已被授予所有必需的权限

[Unit]  
Description=ASP .NET Web Application  
[Service]  
WorkingDirectory=/var/netcore/publish  
ExecStart=/opt/rh/rh-dotnet31/usr/bin/dotnet /var/netcore/publish/Test.dll  
Restart=always  
RestartSec=10  
SyslogIdentifier=netcore-demo  
User=root  
Environment=ASPNETCORE_ENVIRONMENT=Production  
[Install]  
WantedBy=multi-user.target  

附加信息:

- 位置 /var/log/httpd/netcore-error.log 的错误日志没有显示任何错误,但我没有服务器至少收到了访问日志中来自以下日志的请求

- 访问日志仅显示以下 22.xx.xxx.xxx -- [日期和时间] "GET /HTTP/1.1" 307 -

  • 我已将的firewalld.service并配置了IP表。
  • 当我使用curl时,没有任何反应。
  • Dotnet 正在侦听端口 5000 和 5001,不知道为什么?
  • Apache 正在侦听端口 80
  • 当使用 dotnet 命令运行应用程序时,它似乎可以工作,应用程序似乎没有问题。
  • 已尝试不指定服务器名称,但仍然没有任何变化

任何帮助将不胜感激,因为现在已经在这个问题上停留了两周。

I am trying to create a web application using dotnet 3.1 and httpd 2.4 with a proxy server but no mater what how the configuration files are the web application is not displayed.
I am using a Fabian with rhel 7.
The following are the configuration file located in the folder /etc/httpd/conf.d/,

<VirtualHost *:80>  
   ServerName 22.xx.xxx.xx
   ProxyPreserveHost On  
   ProxyPass / http://127.0.0.1:5000/  
   ProxyPassReverse / http://127.0.0.1:5000/  
   RewriteEngine on  
   RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]  
   RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]  
   RewriteRule /(.*) ws://127.0.0.1:5000/$1 [P]  
   ErrorLog /var/log/httpd/netcore-error.log  
   CustomLog /var/log/httpd/netcore-access.log common  
</VirtualHost>  

My service file located at /etc/systemd/system and is as follows, i hade ensure that the location of the dotnet location is as follows as it was not installed in the standard location. Additionally the root user has been given all required permission

[Unit]  
Description=ASP .NET Web Application  
[Service]  
WorkingDirectory=/var/netcore/publish  
ExecStart=/opt/rh/rh-dotnet31/usr/bin/dotnet /var/netcore/publish/Test.dll  
Restart=always  
RestartSec=10  
SyslogIdentifier=netcore-demo  
User=root  
Environment=ASPNETCORE_ENVIRONMENT=Production  
[Install]  
WantedBy=multi-user.target  

Additional info:

-The error log at location /var/log/httpd/netcore-error.log displays no errors but I no the server has atleast received a request from the following log in the access log

-The access log only shows the following 22.xx.xxx.xxx -- [Date and Time] "GET /HTTP/1.1" 307 -

  • I have turned of the firewalld.service and configured the IPtable.
  • When I use curl, there is no response.
  • Dotnet is listening in port 5000 and 5001, not sure why?
  • Apache is listening in port 80
  • When run the application from with dotnet command it seem to work, there does not seem to a problem with the application.
  • Have tried without specifying the server name and still had no change

Any help would be appreciated as have been stuck on this problem for 2 weeks now.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

极度宠爱 2025-01-18 18:40:07

只是一个更新 - 事实证明这是代码/配置的问题。我认为它被称为 launchsetting.json 文件,该文件强制将连接设置为 HTTPS 并将其转发到错误的端口。只需删除该部分,一切都很好。

Just an update - turns out it was a problem with the code/configuration. I think it was called launchsetting.json file, which forcefully made the connection a HTTPS and forward it to the wrong port. Just had to remove that section and all was good.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文