Linux使用.net core
安装nginx 1 1yum install nginx查看nginx是否安装成功 1 1
nginx -t查看nginx版本 1 1
nginx -v查看nginx安装目录 1 1
rpm -ql nginx启动nginx 8 1
// 查看安装目录2
rpm -ql nginx3 4
// 得到nginx目录5 6
cd /usr/sbin7 8
./nginx配置开机自启 5 1
vim /etc/rc.d/rc.local2 3
添加4
#开机自启5
/usr/sbin/nginx安装.net core runtime 4 1
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm2 3
// 安装包含asp net core的运行时4
sudo yum install aspnetcore-runtime-5.0安装sqlserver 4 1
// 下载微软yum源2
wget -O /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo3
// 安装 sqlserver4
yum install -y mssql-server服务器可用内存小于2g 17 1
// 破解限制2
//首先切换到 /opt/mssql/bin 目录下3
cd /opt/mssql/bin/4
// 然后保存备份文件5
mv sqlservr sqlservr.old6 7
//使用python修改二进制文件,把里面的2G内存限制改为512M8 9
python10 11
oldfile = open("sqlservr.old", "rb").read()12 13
newfile = oldfile.replace("\x00\x94\x35\x77", "\x00\x80\x84\x1e")14 15
open("sqlservr", "wb").write(newfile)16 17
exit()选择sqlserver版本,并设置sa账号密码 15 1
// 终端内输入2
/opt/mssql/bin/mssql-conf setup3 4
// 显示以下内容5
Choose an edition of SQL Server:6
1) Evaluation (free, no production use rights, 180-day limit)7
2) Developer (free, no production use rights)8
3) Express (free)9
4) Web (PAID)10
5) Standard (PAID)11
6) Enterprise (PAID)12
7) Enterprise Core (PAID)13
8) I bought a license through a retail sales channel and have a product key to enter.14 15
//输入3(免费版本)检测sql server是否安装成功 1 1
systemctl status mssql-serversql server在Centos安装centos7.x中安装SQL Server - 吕小不 - 博客园 (cnblogs.com) 配置Nginx 3 1
// Nginx目录2 3
/usr/local/nginx给程序权限否则无法运行 3 1
chmod 777 文件名称2 3
./程序名
linux需要安装libgdiplus否则qrcode(二维码)无法使用
1 1yum install libgdiplus
监视应用,进程守护
39 1// 创建服务文件2
sudo nano /etc/systemd/system/kestrel-NetWebGta.service3 4 5
// 输入6
[Unit]7
Description=Example .NET Web API App running on Ubuntu8 9
[Service]10
WorkingDirectory=/var/www/你的目录11
ExecStart=/usr/bin/dotnet /var/www/你的目录/你的网站.dll12
Restart=always13
# Restart service after 10 seconds if the dotnet service crashes:14
RestartSec=1015
KillSignal=SIGINT16
SyslogIdentifier=dotnet-example17
User=root18
Environment=ASPNETCORE_ENVIRONMENT=Production19
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false20 21
[Install]22
WantedBy=multi-user.target23
// 按ctrl+x退出24 25
// 启动服务26
sudo systemctl start kestrel-NetWebGta.service27 28
// 查看服务状态29
sudo systemctl status kestrel-NetWebGta.service30 31
# 立即启动一个服务32
$ sudo systemctl start kestrel-NetWebGta.service33 34
# 立即停止一个服务35
$ sudo systemctl stop kestrel-NetWebGta.service36 37
# 重启一个服务38
$ sudo systemctl restart kestrel-NetWebGta.service39