System
aarch64
1$ uname -a
2Linux yhy-87 5.10.0-153.12.0.92.oe2203sp2.aarch64 #1 SMP Wed Jun 28 23:18:48 CST 2023 aarch64 aarch64 aarch64 GNU/Linux
3$ cat /etc/os-release
4NAME="openEuler"
5VERSION="22.03 (LTS-SP2)"
6ID="openEuler"
7VERSION_ID="22.03"
8PRETTY_NAME="openEuler 22.03 (LTS-SP2)"
9ANSI_COLOR="0;31"
x86_64
1$ uname -a
2Linux yhy-106 5.10.0-182.0.0.95.oe2203sp3.x86_64 #1 SMP Sat Dec 30 13:10:36 CST 2023 x86_64 x86_64 x86_64 GNU/Linux
3$ cat /etc/os-release
4NAME="openEuler"
5VERSION="22.03 (LTS-SP3)"
6ID="openEuler"
7VERSION_ID="22.03"
8PRETTY_NAME="openEuler 22.03 (LTS-SP3)"
9ANSI_COLOR="0;31"
Download
aarch64
1https://dl-cdn.openeuler.openatom.cn/openEuler-22.03-LTS-SP3/everything/aarch64/Packages/
x86_64
1https://dl-cdn.openeuler.openatom.cn/openEuler-22.03-LTS-SP3/everything/x86_64/Packages/
Installation Packages
1gd-2.3.3-4.oe2203sp3.x86_64.rpm
2gperftools-2.10-2.oe2203sp3.x86_64.rpm
3gperftools-libs-2.10-2.oe2203sp3.x86_64.rpm
4libunwind-1.6.2-7.oe2203sp3.x86_64.rpm
5libwebp-1.2.1-5.oe2203sp3.x86_64.rpm
6libXpm-3.5.13-5.oe2203sp3.x86_64.rpm
7libxslt-1.1.37-1.oe2203sp3.x86_64.rpm
8nginx-1.21.5-6.oe2203sp3.x86_64.rpm
9nginx-all-modules-1.21.5-6.oe2203sp3.noarch.rpm
10nginx-filesystem-1.21.5-6.oe2203sp3.noarch.rpm
11nginx-mod-http-image-filter-1.21.5-6.oe2203sp3.x86_64.rpm
12nginx-mod-http-perl-1.21.5-6.oe2203sp3.x86_64.rpm
13nginx-mod-http-xslt-filter-1.21.5-6.oe2203sp3.x86_64.rpm
14nginx-mod-mail-1.21.5-6.oe2203sp3.x86_64.rpm
15nginx-mod-stream-1.21.5-6.oe2203sp3.x86_64.rpm
Installation
1$ rpm -ivh *.rpm
2Verifying... ################################# [100%]
3Preparing... ################################# [100%]
4Upgrading/Installing...
51:nginx-filesystem-1:1.21.5-6.oe220################################# [ 7%]
62:libxslt-1.1.37-1.oe2203sp3 ################################# [ 13%]
73:libXpm-3.5.13-5.oe2203sp3 ################################# [ 20%]
84:libwebp-1.2.1-5.oe2203sp3 ################################# [ 27%]
95:gd-2.3.3-4.oe2203sp3 ################################# [ 33%]
106:libunwind-2:1.6.2-7.oe2203sp3 ################################# [ 40%]
117:gperftools-libs-2.10-2.oe2203sp3 ################################# [ 47%]
128:nginx-mod-http-perl-1:1.21.5-6.oe################################# [ 53%]
139:nginx-mod-http-xslt-filter-1:1.21################################# [ 60%]
1410:nginx-mod-mail-1:1.21.5-6.oe2203s################################# [ 67%]
1511:nginx-mod-stream-1:1.21.5-6.oe220################################# [ 73%]
1612:nginx-1:1.21.5-6.oe2203sp3 ################################# [ 80%]
1713:nginx-mod-http-image-filter-1:1.2################################# [ 87%]
1814:nginx-all-modules-1:1.21.5-6.oe22################################# [ 93%]
1915:gperftools-2.10-2.oe2203sp3 ################################# [100%]
Start
1# Enable on boot
2systemctl enable nginx
3# Start
4systemctl start nginx
5# Check status
6systemctl status nginx
7# View logs
8journalctl -u nginx -f
Service
1[Unit]
2Description=The nginx HTTP and reverse proxy server
3After=network.target remote-fs.target nss-lookup.target
4[Service]
5Type=forking
6PIDFile=/run/nginx.pid
7# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
8# SELinux context. This might happen when running `nginx -t` from the cmdline.
9ExecStartPre=/usr/bin/rm -f /run/nginx.pid
10ExecStartPre=/usr/sbin/nginx -t
11ExecStart=/usr/sbin/nginx
12ExecReload=/bin/kill -s HUP $MAINPID
13KillSignal=SIGQUIT
14TimeoutStopSec=5
15KillMode=mixed
16PrivateTmp=true
17[Install]
18WantedBy=multi-user.target
Configuration
1# cat /etc/nginx/nginx.conf
2# For more information on configuration, see:
3# * Official English Documentation: http://nginx.org/en/docs/
4# * Official Russian Documentation: http://nginx.org/ru/docs/
5user nginx;
6worker_processes auto;
7error_log /var/log/nginx/error.log;
8pid /run/nginx.pid;
9# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
10include /usr/share/nginx/modules/*.conf;
11events {
12worker_connections 1024;
13}
14http {
15log_format main '$remote_addr - $remote_user [$time_local] "$request" '
16'$status $body_bytes_sent "$http_referer" '
17'"$http_user_agent" "$http_x_forwarded_for"';
18 access_log /var/log/nginx/access.log main;
19 sendfile on;
20 tcp_nopush on;
21 tcp_nodelay on;
22 keepalive_timeout 65;
23 types_hash_max_size 4096;
24 include /etc/nginx/mime.types;
25 default_type application/octet-stream;
26 # Load modular configuration files from the /etc/nginx/conf.d directory.
27 # See http://nginx.org/en/docs/ngx_core_module.html#include
28 # for more information.
29 include /etc/nginx/conf.d/*.conf;
30 server {
31 listen 80;
32 listen [::]:80;
33 server_name _;
34 root /usr/share/nginx/html;
35 # Load configuration files for the default server block.
36 include /etc/nginx/default.d/*.conf;
37 error_page 404 /404.html;
38 location = /40x.html {
39 }
40 error_page 500 502 503 504 /50x.html;
41 location = /50x.html {
42 }
43 }
44# Settings for a TLS enabled server.
45#
46# server {
47# listen 443 ssl http2;
48# listen [::]:443 ssl http2;
49# server_name _;
50# root /usr/share/nginx/html;
51#
52# ssl_certificate "/etc/pki/nginx/server.crt";
53# ssl_certificate_key "/etc/pki/nginx/private/server.key";
54# ssl_session_cache shared:SSL:1m;
55# ssl_session_timeout 10m;
56# ssl_ciphers PROFILE=SYSTEM;
57# ssl_prefer_server_ciphers on;
58#
59# # Load configuration files for the default server block.
60# include /etc/nginx/default.d/*.conf;
61#
62# error_page 404 /404.html;
63# location = /40x.html {
64# }
65#
66# error_page 500 502 503 504 /50x.html;
67# location = /50x.html {
68# }
69# }
70}
Open Ports
1# Start the firewall
2systemctl start firewalld
3# Check open ports
4firewall-cmd --list-ports
5# Add open port
6firewall-cmd --permanent --add-port=6379/tcp
7# Reload configuration
8firewall-cmd --reload
Testing
1curl http://127.0.0.1