Skip to content

iaspnetcore/MiniBlog.Core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blog engine for ASP.NET Core 9.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

Miniblog.Core Project:How to Create a Miniblog.Core Project with .Net 6.x step by step https://www.iaspnetcore.com/blogpost-5ec055705d065d499b65df13-how-to-create-a-miniblogcore-project-with-net6x-step-by-step

Miniblog.Core Project:ASP.NET Core 6.x-W3CLogger
https://www.iaspnetcore.com/Blog/BlogPost/618aaa94635c733c81e1486d/miniblogcore-projectaspnet-core-6x-w3clogger

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

Quick Start

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

Quick Start

  1. A Linux domain is available on the Vultr. Also see docker/README.md

2.A Linux server is available on the Vultr. Also see docker/README.md

3.A to server

4.install nginx here(https://www.iaspnetcore.com/Blog/BlogPost/5d9865cc72c1772b244afe0f/how-to-install-and-uninstall-reinstall-nginx-on-ubuntu-1804aliyunvultr)

5.config nginx for your domain

6.install Let's Encrypt 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 - Add an A and AAAA record for your website
    • 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

System.UnauthorizedAccessException: Access to the path '/var/www/Miniblog.Core/Miniblog.Core/src/bin/Release/net8.0/publish/obj' is denied. System.UnauthorizedAccessException: Access to the path '/var/www/Miniblog.Core/src/bin/Release/net8.0/publish/wwwroot/Posts/638056233411122802.json' is denied.

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

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




About

https://miniblog.iaspnetcore.com MiniBlog.Core -Blog engine for ASP.NET Core 9.x Json Data

Resources

Stars

Watchers

Forks

Packages

No packages published