I am on Ubuntu hosting a .NET 6 web app. If I go to the directory where the publish files are stored and run command dotnet webapp.dll
, then I will get something like the output below (Then if I go to the browser and look at the website example.com, the webapp displays fine)
Feb 09 20:52:15 ubuntu dotnet-webapp[2687]: Now listening on: http://localhost:5000
Feb 09 20:52:15 ubuntu dotnet-webapp[2687]: Application started. Press Ctrl+C to shut down.
Feb 09 20:52:15 ubuntu dotnet-webapp[2687]: info: Microsoft.Hosting.Lifetime[0]
Feb 09 20:52:15 ubuntu dotnet-webapp[2687]: Hosting environment: Production
But if I create a service and enable it, I see that the output above displays if I run the command: sudo journalctl -fu webapp.service
However, example.com says "This site can’t be reached"
Would like some help please.
Config file:
<VirtualHost *:80>
ServerName company.com
ServerAdmin admin.com
DocumentRoot /var/www/company.com
ProxyPreserveHost On
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /(.*) ws://127.0.0.1:5000/$1 [P]
ErrorLog ${APACHE_LOG_DIR}/error-company.com.log
CustomLog ${APACHE_LOG_DIR}/access-company.com.log combined
</VirtualHost>