nginx basic, command

1
2
3
4
5
6
7
8
9
# Do not run, just test the configuration file.
sudo nginx -t

nginx -s signal

# stop — fast shutdown
# quit — graceful shutdown
# reload — reloading the configuration file
# reopen — reopening the log files

almalinux install nginx

1
2
3
sudo dnf update -y
sudo dnf install nginx -y
sudo systemctl enable --now  nginx
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# install

# nerdctl
nerdctl run -d \
--name nginx \
--restart=always \
-p 80:80 \
-p 443:443 \
-v nginx-config:/etc/nginx \
-v nginx-www:/var/www \
-v /etc/letsencrypt:/etc/letsencrypt \
-v /etc/localtime:/etc/localtime:ro \
nginx:1.27.2

# docker
docker run -d \
--name nginx \
--restart=always \
-p 80:80 \
-p 443:443 \
-v nginx-config:/etc/nginx \
-v nginx-www:/var/www \
-v /etc/letsencrypt:/etc/letsencrypt \
-v /etc/localtime:/etc/localtime:ro \
nginx:1.27.2

docker run -d \
--name nginx \
--restart=always \
-p 80:80 \
-p 443:443 \
-v nginx-config:/etc/nginx \
-v nginx-www:/var/www \
-v /etc/localtime:/etc/localtime:ro \
nginx:1.27.2

# podman
podman run -d \
--name nginx \
-p 80:80 \
-p 443:443 \
-v nginx-config:/etc/nginx \
-v nginx-www:/var/www \
-v nginx-cert:/etc/letsencrypt \
-v /etc/localtime:/etc/localtime:ro \
nginx:1.27.2

# nginx config text
docker run --name nginx-config-test --rm -t -a stdout -v nginx-conf:/etc/nginx:ro nginx nginx -c /etc/nginx/nginx.conf -t

# archlinux, mainline branch: new features, updates, bugfixes
sudo pacman -S nginx-mainline

# start
sudo systemctl start nginx

# restart
kill -HUP pid

#stop
kill -s QUIT 1628

文件下载

1
2
3
4
5
6
server {
        listen 8088;
        location /download/images {
                alias /home/net-files/images; # 我在这个路径下放了一张图片: fei_ji.jpg
        }
}

下载

1
curl "http://my_ip_address:8088/download/images/fei_ji.jpg" > test.jpg

———————————————— 版权声明: 本文为CSDN博主「tomeasure」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接: https://blog.csdn.net/qq_29695701/article/details/86491331