前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >centos7构建nginx quic支持

centos7构建nginx quic支持

原创
作者头像
峨眉山市雅铭网络
发布2024-06-15 12:24:18
2090
发布2024-06-15 12:24:18
举报
文章被收录于专栏:Linux云服务器Linux云服务器

centos7构建nginx quic支持

注意默认在root用户下进行的操作

1、安装依赖

代码语言:shell
复制
yum install patch wget make gcc gcc-c++ gcc-gfortran kernel-devel ncurses ncurses-devel gd gd-devel libicu lua zlib-devel openssl-devel pcre-devel perl-IPC-Cmd -y

注:perl-IPC-Cmd 为openssl-quic中的依赖需求必须安装

2、下载源码包并解压

代码语言:shell
复制
wget https://nginx.org/download/nginx-1.27.0.tar.gz

tar -xzf nginx-1.27.0.tar.gz

3、下载quicssl库依赖并解压

代码语言:shell
复制
wget https://github.com/quictls/openssl/archive/refs/tags/openssl-3.1.5-quic1.tar.gz

tar -xzf openssl-3.1.5-quic1.tar.gz 

4、进入nginx源码目录开始构建

代码语言:shell
复制
cd nginx-1.27.0

5、配置构建参数

代码语言:shell
复制
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v3_module --with-cc-opt=-I../openssl-openssl-3.1.5-quic1/include --with-ld-opt=-L../openssl-openssl-3.1.5-quic1/lib --with-openssl=../openssl-openssl-3.1.5-quic1

6、构建并且安装

代码语言:shell
复制
make & make install

7、配置用户组

代码语言:shell
复制
useradd -M nginx

8、创建缺失的目录

代码语言:shell
复制
mkdir -p /var/cache/nginx/client_temp
mkdir -p /var/log/nginx
mkdir -p /usr/lib64/nginx/modules //此目录非必须,该目录为添加动态模块用途

9、配置服务并且设置开机启动

代码语言:shell
复制
vi /usr/lib/systemd/system/nginx.service

将下面的内容复制粘贴上去:

代码语言:shell
复制
[Unit]
Description=nginx - high performance web server
Documentation=https://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/sh -c "/bin/kill -s HUP $(/bin/cat /var/run/nginx.pid)"
ExecStop=/bin/sh -c "/bin/kill -s TERM $(/bin/cat /var/run/nginx.pid)"

[Install]
WantedBy=multi-user.target

10、执行重载命令

代码语言:shell
复制
systemctl daemon-reload

11、配置开机启动

代码语言:shell
复制
systemctl enable nginx

12、启动nginx服务

代码语言:shell
复制
systemctl start nginx

13、查看nginx服务状态

代码语言:shell
复制
systemctl status nginx

14、重启Nginx服务

代码语言:shell
复制
systemctl restart nginx

15、关闭开机启动

代码语言:shell
复制
systemctl disable nginx

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • centos7构建nginx quic支持
    • 注意默认在root用户下进行的操作
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档