第一步安装 nginx1. 确定系统信息用root用户执行nkvers命令查看系统信息############## Kylin Linux Version ################# Release: Kylin Linux Advanced Server release V10 (Sword) Kernel: 4.19.90-24.4.v2101.ky10.aarch64 Build: Kylin Linux Advanced Server release V10 (SP2) /(Sword)-aarch64-Build09/20210524 #################################################麒麟操作系统版本V10SP2内核4.19.90-24.4.v2101.ky10.aarch64CPU架构aarch642. 检查是否已安装nginx切换到root用户之后的操作都是以root身份进行然后查看nginx进程sudo -i # [sudo] admin 的密码 ps -ef | grep nginx # root 49691 46266 0 14:28 pts/4 00:00:00 grep nginx如果输出只有一行并且以grep nginx结尾则说明服务器很干净你需要先安装nginx服务。如果输出N多个进程信息那么恭喜你可以省去安装步骤sudo ps -ef | grep nginx # root 496080 1 0 6月16 ? 00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; # www-data 497758 496080 0 6月16 ? 00:00:00 nginx: worker process # www-data 497767 496080 0 6月16 ? 00:00:00 nginx: worker process # www-data 497768 496080 0 6月16 ? 00:00:00 nginx: worker process # root 626417 626348 0 14:32 pts/0 00:00:00 grep --colorauto nginx主进程master process信息中会标识nginx的安装目录本例为/usr/sbin/nginx。3. 尝试用安装包直接安装这里非常容易踩坑极易出现兼容性或者缺少依赖项等问题。我的思路是先确定系统兼容项再针对下载特定包。经过网络搜索和AI大致确定我这个版本的麒麟V10SP2与CentOS 8更兼容进一步验证检查项目命令输出glibcldd --version | head -n1ldd (GNU libc) 2.28opensslopenssl versionOpenSSL 1.1.1f 31 Mar 2020gccgcc --version | head -n1gcc (GCC) 7.3.0确认我的判断。先尝试直接用编译好的安装包安装如果能成功就省去编译工作从 nginx 官网下载CentOS 8兼容的el8版本的安装包nginx-1.30.2-1.el8.ngx.aarch64.rpm上传到服务器/opt/software/nginx/nginx-1.30.2-1.el8.ngx.aarch64.rpm执行安装:cd /opt/software/nginx rpm -ivh ./nginx-1.30.2-1.el8.ngx.aarch64.rpm稍微等待片刻便安装成功(忽略其他警告信息)警告./nginx-1.30.2-1.el8.ngx.aarch64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID ********: NOKEY Verifying... ################################# [100%] 准备中... ################################# [100%] 正在升级/安装... 1:nginx-1:1.30.2-1.el8.ngx ################################# [100%] ---------------------------------------------------------------------- Thanks for using nginx! ...验证安装nginx -vnginx version: nginx/1.30.2which nginx/usr/sbin/nginx至此已经成功在麒麟OS系统安装nginx/1.30.2。4. 启动nginx服务查看nginx服务状态systemctl status nginx服务状态正常Active: active (running)● nginx.service - nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: active (running) since Thu 2026-06-18 09:06:16 CST; 6s ago Docs: http://nginx.org/en/docs/ Process: 59666 ExecStart/usr/sbin/nginx -c ${conffile} (codeexited, status0/SUCCESS) Main PID: 59667 (nginx) Tasks: 49 Memory: 125.4M CGroup: /system.slice/nginx.service ├─59667 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf ├─59668 nginx: worker process ├─59669 nginx: worker process ...如果nginx服务未能正常启动则需要排查原因解决问题。第二步部署前端应用假定前端项目是unidmrcore组织的multi-tenant应用:文件路径是/opt/unidmrcore/multi-tenant/监听的端口是10115nginx配置文件是/etc/nginx/conf.d/unidmrcore_multi_tenant.confnginx日志写入/var/log/nginx/unidmrcore_multi_tenant_access.log/var/log/nginx/unidmrcore_multi_tenant_error.log1. 准备前端部署文件上传安装包到/opt/unidmrcore/multi-tenant/dist.zip解压缩安装包unzip /opt/unidmrcore/multi-tenant/dist.zip -d /opt/unidmrcore/multi-tenant/确认内容ls /opt/unidmrcore/multi-tenant/dist2. 配置nginx创建nginx配置文件tee /etc/nginx/conf.d/unidmrcore_multi_tenant.conf EOF server { listen 10115; root /opt/unidmrcore/multi-tenant/dist; index index.html; # 字符编码 charset utf-8; # 日志配置 access_log /var/log/nginx/unidmrcore_multi_tenant_access.log; error_log /var/log/nginx/unidmrcore_multi_tenant_error.log; location / { try_files $uri $uri/ /index.html; } } EOF验证配置文件并重新加载nginx -t systemctl reload nginx # nginx: the configuration file /etc/nginx/nginx.conf syntax is ok # nginx: configuration file /etc/nginx/nginx.conf test is successful复核nginx服务状态systemctl status nginx # ● nginx.service - nginx - high performance web server # Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) # Active: active (running) since Thu 2026-06-18 09:06:16 CST; 34min ago # Docs: http://nginx.org/en/docs/ # Process: 59666 ExecStart/usr/sbin/nginx -c ${conffile} (codeexited, status0/SUCCESS) # Process: 60358 ExecReload/bin/sh -c /bin/kill -s HUP $(/bin/cat /run/nginx.pid) (codeexited, status0/SUCCESS) # Main PID: 59667 (nginx) # Tasks: 49 # Memory: 151.3M # CGroup: /system.slice/nginx.service # ├─59667 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf # ├─60360 nginx: worker process # ├─60361 nginx: worker process3. 防火墙放行本机使用的是iptables放行10115端口并持久化生效:iptables -I INPUT -p tcp --dport 10115 -j ACCEPT service iptables save # iptables: Saving firewall rules to /etc/sysconfig/iptables: [ OK ]接下来只需要在本地(能访问通服务器的终端)验证服务器10115端口可以访问即可。至此已经完成把nginx安装到麒麟V10并部署前端应用的全部工作。