# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
server {
listen 80;
# 网站文件的目标位置
root /home/hippie/website/wwwroot;
# 网站域名
server_name your website name;
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;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
点击 Save 按钮并执行发布操作。然后将 publish 文件夹上传至服务器相应位置,上传成功后执行
dotnet run app.dll
如果不出意外的,这个时候,你就可以通过 IP 或者 你的网站域名来进行访问了。 创建守护进程
执行上述操作之后,我们的程序还是不能正在长时间运行,因此我们需要通过守护进程来管理我们的网站
sudo apt-get install supervisor
sudo vim /ect/supervisor/conf.d/website.conf