AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

Add section on "app's executable" in "Host ASP.NET Core on Linux with Nginx"

Open melmi opened this issue 8 years ago • 8 comments

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.

melmi avatar Sep 26 '18 07:09 melmi

Excellent point @melmi ... you're correct. Use the dotnet command with the DLL. I'll fix the topic when I get back from vacation. 🏖

guardrex avatar Sep 26 '18 12:09 guardrex

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

BlueMarmalade avatar Sep 30 '18 10:09 BlueMarmalade

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?

guardrex avatar Sep 30 '18 13:09 guardrex

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 avatar Oct 01 '18 06:10 BlueMarmalade

@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 DocumentRoot directive 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.

guardrex avatar Oct 01 '18 12:10 guardrex

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/

BlueMarmalade avatar Oct 01 '18 12:10 BlueMarmalade

Do you want me to change the path from /var/aspnetcore/hellomvc to /var/www/hellomvc on this update?

No preferences

shirhatti avatar Oct 02 '18 01:10 shirhatti

Ok ... so my action items for the update are:

  1. Fix the ./<app_executable> bit.
  2. Drop "mvc" from naming and go with "app."
  3. Let's go with /var/www/helloapp.
  4. Apply similar updates to the Apache topic.

I'll be back from vacation shortly and push this forward. Thanks all! 🎸

guardrex avatar Oct 02 '18 03:10 guardrex