Add section on "app's executable" in "Host ASP.NET Core on Linux with Nginx"
Hi,
This question might be so dumb, but what is the meaning of "app's executable" in this document? I am asking this because in my case, developing a web API, the output of the project is a single DLL. Should I use dotnet <app_assembly>.dll instead of ./<app_executable>? If yes, I think it is better to mention it explicitly in this document.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: dcdd2c35-bf2b-2673-d150-303a8aaa54d2
- Version Independent ID: 815fe034-c9fc-aee3-a8b5-f2e860b30302
- Content: Host ASP.NET Core on Linux with Nginx
- Content Source: aspnetcore/host-and-deploy/linux-nginx.md
- Product: aspnet-core
- GitHub Login: @Rick-Anderson
- Microsoft Alias: riande
Excellent point @melmi ... you're correct. Use the dotnet command with the DLL. I'll fix the topic when I get back from vacation. 🏖
I can't get it to start by typing ./myappname.dll in bash. I can by typing: dotnet myappname.dll . But creating service file and starting it works: also this is less confusing because usually the publish folder for the website would be in www: [Service] WorkingDirectory=/var/www/myappname ExecStart=/usr/bin/dotnet /var/www/myappname/myappname.dll Restart=always RestartSec=10 SyslogIdentifier=myappname User=www-data Environment=ASPNETCORE_ENVIRONMENT=Production
just small details like that saves frustration for me. then refer service file by myappname only: sudo systemctl enable myappname sudo systemctl start myappname enable permission to www-data: sudo chown -R www-data:www-data /var/www/myappname
Thanks for the notes @BlueMarmalade.
@shirhatti Do you want me to change the path from /var/aspnetcore/hellomvc to /var/www/hellomvc on this update?
Either way, we should remove/swap "mvc" given the focus on RP now. How about just helloapp and kestrel-helloapp.service?
yes, because having two different locations for the app on a server is confusing. usually i only have a publish folder for my apps, which is in /var/www/appname.
@BlueMarmalade This topic was written by @shirhatti, so I want to make sure he's cool with the change.
According to web sources, the default web root is actually /var/www/html, so we might want to make it /var/www/html/helloapp.
Source: https://help.ubuntu.com/lts/serverguide/httpd.html
The
DocumentRootdirective specifies where Apache2 should look for the files that make up the site. The default value is/var/www/html, as specified in/etc/apache2/sites-available/000-default.conf.
Maybe. But I don't think it makes sense to put your app into the html directive. Many of the docs for Apache has bad practices, like putting sites into the /sites-available and /sites-enabled directives in nginx. These folders can be affected by upgrades to nginx. Putting the app into the html directive is also a bit strange to me, because for me html is a specific markup format. So reading on the docs at Linode.com for nginx they recommend putting it into the /var/www/ directive and create a directive for your app with the name of it's url. So it would be something like this: /var/www/yourapp.com
https://www.linode.com/docs/web-servers/nginx/nginx-installation-and-basic-setup/
Do you want me to change the path from
/var/aspnetcore/hellomvcto/var/www/hellomvcon this update?
No preferences
Ok ... so my action items for the update are:
- Fix the
./<app_executable>bit. - Drop "mvc" from naming and go with "app."
- Let's go with
/var/www/helloapp. - Apply similar updates to the Apache topic.
I'll be back from vacation shortly and push this forward. Thanks all! 🎸