Skip to content

Latest commit

 

History

History
273 lines (159 loc) · 9.44 KB

README.md

File metadata and controls

273 lines (159 loc) · 9.44 KB

Blog engine for ASP.NET Core 8.x

miniblog.iaspnetcore.com

A full-featured yet simple blog engine built on ASP.NET Core 8.x. bootstrap 5.x + json data + .net 8.x.

I have a vps on vultr.com running Ubuntu, and installed ASP.NET Core 8.x many months ago.

Browser Cloudflare Origin Server http://localhost:7600 full mode

project git information

20221126

local disk; f:\developer_mini_core_json

github:https://github.com/iaspnetcore/MiniBlog.Core.git

domain:miniblog.iaspnetcore.com on vultr

\src\Miniblog.Core\wwwroot\Posts\files \src\Miniblog.Core\wwwroot\Posts

Blog https://www.iaspnetcore.com/blogpost-5ec055705d065d499b65df13-how-to-create-a-miniblogcore-project-with-net6x-step-by-step

CRUD Operation With JSON File Data In C#

https://www.iaspnetcore.com/blogpost-629d3d6d0cdc850252550b72-crud-operation-with-json-file-data-in-c

Create a ViewComponents https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-components?view=aspnetcore-6.0

Theme templates come from:https://getbootstrap.com/docs/5.1/examples/blog/#

Live demo: https://miniblog.iaspnetcore.com/
Username: demo
Password: demo

Custom themes

1.buy domain

2.buy server

3.A to server

4.install nginx

5.config nginx for your domain

6.install Let’s Encrypt client certbot

7.downloaded SSL certificates for your domain

8.run local web server

没有账号的点我注册Vultr账号(注册就送20美元哦)https://www.vultr.com/?ref=7035322-3B

Vultr注册购买图文教程 Click here.

Features

buy domain

  • Log in to your domain registrar
  • Update your nameservers - change your default Nameservers to Cloudflare Nameservers
    • Change Name Servers dns to cf - Find the list of nameservers at your registrar. Add both of your assigned Cloudflare nameservers, remove any other nameservers, and save your changes.Change Name Servers dns to cf

buy server

cloudflare

  • cloudflare login
  • Add Site
    • Add Site - Add your Site to cloudflare
  • Create DNS records
    • Create DNS records - For A, AAAA records, decide whether hostname traffic is proxied through Cloudflare.
  • SSL/TLS encryption mode is Full, Encrypts traffic between the browser and Cloudflare,Cloudflare and Origin Server

nginx server on vps

How to use

On the command line

cd /
cd /var/www/iaspnetcore/developer_mini_core_json_miniblogiaspnetcorecom/developer_mini_core_json/src/Miniblog.Core

dotnet run --urls http://0.0.0.0:6002

dotnet run --urls http://localhost:6002

output


info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:6002
dbug: Microsoft.AspNetCore.Hosting.Diagnostics[13]
      Loaded hosting startup assembly Miniblog.Core
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]



miniblog.iaspnetcore.com服务器配置

 miniblog.iaspnetcore.com服务器配置

1.miniblog.iaspnetcore.com

命令行启动

Debug

sudo systemctl stop kestrel-miniblogiaspnetcorecom.service

cd /
cd /var/www/iaspnetcore/developer_mini_core_json_miniblogiaspnetcorecom/developer_mini_core_json/src/Miniblog.Core


dotnet run --urls http://0.0.0.0:6002

dotnet run --urls http://localhost:6002


Release

sudo systemctl stop kestrel-miniblogiaspnetcorecom.service


cd /var/www/iaspnetcore/developer_mini_core_json_miniblogiaspnetcorecom/developer_mini_core_json/src/Miniblog.Core

dotnet publish -c release

Output

Miniblog.Core -> /var/www/iaspnetcore/developer_mini_core_json_miniblogiaspnetcorecom/developer_mini_core_json/src/Miniblog.Core/bin/Release/net8.0/Miniblog.Core.dll Adding WebOptimizer cache files to publish output Miniblog.Core -> /var/www/iaspnetcore/developer_mini_core_json_miniblogiaspnetcorecom/developer_mini_core_json/src/Miniblog.Core/bin/Release/net8.0/publish/



cd /var/www/iaspnetcore/developer_mini_core_json_miniblogiaspnetcorecom/developer_mini_core_json/src/Miniblog.Core/bin/Release/net8.0/publish/

dotnet Miniblog.Core.dll  --urls http://127.0.0.1:6002


2.服务配置

sudo vi /etc/systemd/system/kestrel-miniblogiaspnetcorecom.service

path:/etc/systemd/system/kestrel-miniblogiaspnetcorecom.service

kestrel-miniblogiaspnetcorecom.service

[Unit]
Description=miniblog.iaspnetcore.com App running on Ubuntu

[Service]
WorkingDirectory=/var/www/MiniBlog.Core/src/Miniblog.Core/bin/Release/net8.0/publish
ExecStart=/usr/bin/dotnet /var/www/MiniBlog.Core/src/Miniblog.Core/bin/Release/net8.0/publish/Miniblog.Core.dll --urls http://localhost:6002
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=miniblog.iaspnetcore.com
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target

3.Install first kestrel-miniblogiaspnetcorecom.service

sudo systemctl daemon-reload 
sudo systemctl enable kestrel-miniblogiaspnetcorecom.service
sudo systemctl start kestrel-miniblogiaspnetcorecom.service
sudo systemctl status kestrel-miniblogiaspnetcorecom.service


sudo systemctl restart kestrel-miniblogiaspnetcorecom.service
sudo systemctl stop kestrel-miniblogiaspnetcorecom.service
sudo systemctl status kestrel-miniblogiaspnetcorecom.service

sudo journalctl -fu kestrel-miniblogiaspnetcorecom.service



sudo systemctl restart kestrel-miniblogiaspnetcorecom.service


4.批处理

cp  -r /var/www/MiniBlog.Core/src/Miniblog.Core/bin/Release/net8.0/publish/wwwroot/uploadimages  /var/www/MiniBlog.Core/src/Miniblog.Core/src/wwwroot/uploadimages



sudo systemctl stop kestrel-miniblogiaspnetcorecom.service

cd /
cd /var/www/MiniBlog.Core/src/Miniblog.Core
dotnet publish -c release

sudo systemctl daemon-reload 
sudo systemctl restart kestrel-miniblogiaspnetcorecom.service

chmod 777 /var/artifacts
chmode 777 /var/www/MiniBlog.Core/src/Miniblog.Core/bin/Release/net8.0/publish/wwwroot/Posts