I am hosting a net6 web app on Ubuntu (Port 80 is opened). My service file:
[Unit]
Description= companydir .NET Core Web Application
[Service]
WorkingDirectory=/var/www/companydir
ExecStart=/home/ubuntu/.dotnet/dotnet /var/www/companydir/webapp.dll
Restart=always
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-webapp
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
When I run the following commands, I dont see errors.
sudo journalctl -fu webapp
sudo systemctl status webapp
I see mysql queries and that my service is active
Loaded: loaded (/etc/systemd/system/webapp.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-02-09 20:52:13 EST; 24h ago
But when I go to the URL online, It says the site cant be reached. I don't know what happened.
Update 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>