麒麟桌面版安装nginx
1.解压安装包
tar -zxf nginx-1.25.1.tar.gz
2.进入解压后文件夹
cd nginx-1.25.1
3.配置nginx
./configure

报错
麒麟桌面版 安装nginx时 ./configure: error: C compiler cc is not found
# 安装 GCC 和基础编译工具(包含 make、libc-dev 等,后续编译 Nginx 会用到)
sudo apt install -y gcc build-essential

这种情况是没有外网。
./configure
报错 make&&make install
make: *** 没有规则可制作目标“build”,由“default” 需求。 停止
cd /home/kylin/桌面/nginx1.28/nginx-1.28.0
./configure
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
这是代表没有成功
sudo apt install -y libpcre3-dev
./configure
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option. 这是代表没有成功
sudo apt install -y zlib1g-dev
./configure
4.编译安装
make&&make install

5.运行nginx
进入目录
cd /usr/local/nginx/sbin
启动nginx
sudo ./nginx
6.配置nginx 配置文件在/usr/local/nginx/conf

7.重启nginx
/usr/local/nginx/sbin/nginx -s reload
8.关闭nginx
# 快速停止nginx ./nginx -s stop
9.查询nginx进程
ps -ef|grep nginx
10.nginx配置文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name 127.0.0.1;
location / {
root /opt/server_web/dist;
index index.html index.htm;
try_files $uri $uri/ /index.html; # 处理前端路由(这个很重要)
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

浙公网安备 33010602011771号