https://xn—ygr25xpohxwz.com/
https://xn—ygr25xpohxwz.com/zero-to-fullstack/lessons/module-2-4/

ssh yourUsername@yourPulbicIp
ssh ubuntu@120.27.141.13

Linux

pwd stands for Print Working Directory in Linux.

It displays the full path of the current directory you’re in.

root@iZbp1ct9olyatqe0bxecfkZ:~# pwd
/root

Commonly used with:

pwd                     # show current directory
ls                      # list files in current directory

Terminal Tips

cd ~

Change to the current user’s home directory.

Nginx

Continuously listen on port 80 and return web page content.

sudo apt update

sudo: superuser do
apt: Advanced Package Tool

sudo apt install nginx -y

-y: 自动回答所有确认提示为 Yes。

安装完成后,确认 Nginx 已经在运行:

systemctl status nginx

如果看到输出里有这一行:

Active: active (running)

说明 Nginx 已经启动,正持续监听用户请求。

Custom Terminal Theme

Open the profile of the terminal.
find

"profiles": 

copy these to it that it can add an acrylic background.

"defaults": {
	"useAcrylic": true,
	"acrylicOpacity": 0.9,
	"fontFace": "JetBrains Mono Medium"
},

or

"fontFace": "LXGW WenKai Mono"
"fontFace": "0xProto Nerd Font Propo"

用winget包管理器来安装主题

winget install oh-my-posh
$PROFILE

In PowerShell, $PROFILE is a special automatic variable that stores the path to your PowerShell profile. It is essentially a script file that runs automatically every time PowerShell starts, similar to .bashrc or .zshrc in Linux.

edit the profile using vscode

CODE $PROFILE
oh-my-posh init pwsh --config $env:POSH_THEMES_PATH\montys.omp.json | Invoke-Expression

Custom Font in VSCODE

Open settings.json
add some kind of nerd font

"terminal.integrated.fontFamily": "'JetBrainsMono NF'",

Deploy A Simple Page Using Nginx

generate ssh code

ssh-keygen -t ed25519 -C "你的邮箱"
cd .ssh/

ls以下

authorized_keys id_ed25519 id_ed25519.pub

open id_ed25519.pub

cat id_ed25519.pub

就是ssh的内容

verify the connection

ssh -T git@github.com

install node

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
 

This command is actually two commands joined by a pipe (|). It downloads an installation script and executes it with root privileges.

sudo apt install -y nodejs # Once the system knows where to find Node.js 22.x, this command performs the actual installation.

open the Nginx config file

sudo vim /etc/nginx/sites-enabled/default

change /var/www/html to your project's directory

Since the project we create is at /root/91PornyVersionOne. We replace it.

语法检查

sudo nginx -t

If nothing wrong happens, it shows this by default.

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

如果看到 syntax is ok 和 test is successful,就说明配置文件没写错。

reload:

sudo systemctl reload nginx

reload 和 restart 不一样:reload 是平滑加载新配置,不中断正在处理的连接;restart 是完全重启进程。我们这种情况用 reload 就够了。


ls -ld /root/91PornyVersionOne
# -l -> Long Format
# -d -> directory

It shows:

dr-xr-x--- 14 root root 4096 Jul 9 00:02 /root

留意开头那串权限里,最后三位是 ---——这代表”其他人”(others)对这个目录没有任何权限。

sudo chmod o+x /root/91PornyVersionOne
  • o 指 others——“既不是属主、也不在属主组”的用户,Nginx 的 www-data 就属于这一类
  • x 给的是”能进入这个目录”的权限(注意:是”能穿过”,不是”能列出里面有什么”)