nginx源码编译安装记录
2023-02-26 12:28:27 时间
nginx 源码安装过程
参考 https://cloud.tencent.com/developer/article/1619507
(福利推荐:阿里云、腾讯云、华为云服务器最新限时优惠活动,云服务器1核2G仅88元/年、2核4G仅698元/3年,点击这里立即抢购>>>)
- nginx源码包下载:http://nginx.org/download/nginx-1.17.0.tar.gz
- 安装库
GCC编译器:yum install gcc gcc-c++
正则表达式PCRE库:yum install -y pcre pcre-devel
zlib压缩库:yum install -y zlib zlib-devel
OpenSSL开发库:yum install -y openssl openssl-devel - 安装
tar -axv -f nginx-1.17.0.tar.gz && cd nginx-1.17.0
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/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-ld-opt="-Wl,-rpath,$LUAJIT_LIB"
make && make install
- 添加系统服务 /usr/lib/systemd/system/nginx.service
[Unit] Description=The nginx HTTP and reverse proxy server After=network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/run/nginx.pid # Nginx will fail to start if /run/nginx.pid already exists but has the wrong # SELinux context. This might happen when running `nginx -t` from the cmdline. # https://bugzilla.redhat.com/show_bug.cgi?id=1268621 ExecStartPre=/usr/bin/rm -f /run/nginx.pid ExecStartPre=/usr/sbin/nginx -t ExecStart=/usr/sbin/nginx ExecReload=/bin/kill -s HUP $MAINPID KillSignal=SIGQUIT TimeoutStopSec=5 KillMode=process PrivateTmp=true [Install] WantedBy=multi-user.target
- 执行以下命令重载配置
systemctl daemon-reload - 启动nginx并设置为开机自启
systemctl start nginx
systemctl enable nginx
你还在原价购买阿里云、腾讯云、华为云、天翼云产品?那就亏大啦!现在申请成为四大品牌云厂商VIP用户,可以3折优惠价购买云服务器等云产品,并且可享四大云服务商产品终身VIP优惠价,还等什么?赶紧点击下面对应链接免费申请VIP客户吧:
相关文章
- 面试官:说说Event Loop事件循环、微任务、宏任务5
- 大厂前端面试考什么?5
- Excelize 2.7.0 发布, 2023 年首个更新
- react的jsx和React.createElement是什么关系?面试常问5
- React面试:谈谈虚拟DOM,Diff算法与Key机制5
- 如何利用六西格玛有效管理项目团队成员?
- 英语不好,对 SAP 英文文档有所畏惧,该怎么办?
- 在同一个 ABAP session 里对 SAP CRM IBASE 进行创建,修改和删除的 ABAP 代码
- Ulysses for Mac(最好用的纯文本编辑器)
- DirEqual for Mac(文件夹快速比较工具)
- FSNotes for Mac(文本编辑工具)中文版
- 越南的 “人口红利”
- 中国存在感最低的省,竟连续2年经济增速第一
- Netflix Mac(奈飞客户端)
- Macs Fan Control Pro for mac( 电脑风扇控制软件)
- 中国在全世界“淘金”
- 万物的数字孪生——代币化资产如何改变(数字)世界
- 房价断崖下跌,这座城市怎么了?
- QQ网页快捷登录有问题如何解决
- QQ浏览器拼写检查如何关闭?