# sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
# apt-get update
# apt-get install nginx
# service nginx start
# vi /etc/nginx/conf.d/prj.conf
server {
listen 80;
server_name prj.domain.com
client_max_body_size 524288000;
location / {
root /prj/www/publish;
index index.html;
access_log /prj/www/log/access.log;
error_log /prj/www/log/error.log;
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Conneciton keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# nginx -s reload
# vi /etc/systemd/sytem/asp.net-prj.service
[Unit]
Description=PRJ .NET Web API Application running on Ubuntu
[Service]
WorkingDirectory=/prj/www/publish
ExecStart=/usr/bin/dotnet /prj/www/publish/XXX.dll
Restart=always
Restartec=10
SyslogIdentifier=prj-web
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
# systemctl enable asp.net-prj.service
# systemctl start asp.net-prj.service
# systemctl status asp.net-prj.service