Saturday, April 9, 2022

[SOLVED] The web application does not display using apache server in linux

Issue

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.


Solution

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.



Answered By - Mufaddal
Answer Checked By - Gilberto Lyons (WPSolving Admin)