publish
dotnet publish --configuration Release
dotnet service 등록
vim /etc/systemd/system/xxxx.service
[Unit]
Description=MySite
[Service]
WorkingDirectory=/publish폴더
ExecStart=/usr/bin/dotnet /publish폴더/xxxx.dll
Restart=always
RestartSec=10 # Restart service after 10 seconds if dotnet service crashes
SyslogIdentifier=dotnet-mysite
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
/etc/nginx/conf.d/xxxx.conf
server {
listen 80;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
nginx -t
nginx -s reload