随笔 - 139  文章 - 1  评论 - 0  阅读 - 47159

nginx服务

Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器 ,同时也提供了IMAP/POP3/SMTP服务。Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力在同类型的网页服务器中表现较好。

安装nginx

安装前需要准备:

[root@elk01 ~]# yum install -y gcc-c++

[root@elk01 ~]# yum install -y pcre pcre-devel

[root@elk01 ~]# yum install -y zlib zlib-devel

[root@elk01 ~]# yum install -y openssl openssl-devel

上传下载好的安装包nginx-1.24.0.tar.gz

安装和编译nginx:

[root@elk01 src]# tar -xvf nginx-1.24.0.tar.gz 

[root@elk01 src]# cd /usr/local/src/nginx-1.24.0/

[root@elk01 nginx-1.24.0]# ./configure --prefix=/usr/local

[root@elk01 nginx-1.24.0]# make && make install

启动nginx:

[root@elk01 conf]# pwd
/usr/local/src/nginx-1.24.0/conf
[root@elk01 conf]# nginx -c /usr/local/src/nginx-1.24.0/conf
conf/ configure
[root@elk01 conf]# nginx -c /usr/local/src/nginx-1.24.0/conf/nginx.conf
[root@elk01 conf]# ps -ef|grep nginx
root 51788 1 0 10:38 ? 00:00:00 nginx: master process nginx -c /usr/local/src/nginx-1.24.0/conf/nginx.conf
nobody 51789 51788 0 10:38 ? 00:00:00 nginx: worker process
root 51791 48694 0 10:38 pts/1 00:00:00 grep --color=auto nginx

检查配置文件是否正确:

[root@elk01 conf]# nginx -t -c /usr/local/src/nginx-1.24.0/conf/nginx.conf
nginx: the configuration file /usr/local/src/nginx-1.24.0/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/src/nginx-1.24.0/conf/nginx.conf test is successful

平滑停止Nginx服务:

[root@elk01 conf]# nginx -s quit
[root@elk01 conf]# ps -ef|grep nginx
root 51833 48694 0 10:40 pts/1 00:00:00 grep --color=auto nginx

 

如果想安装Nginx其它模块,比如:

[root@elk01 nginx-1.24.0]# pwd
/usr/local/src/nginx-1.24.0

[root@elk01 nginx-1.24.0]# ./configure --prefix=/usr/local --with-http_stub_status_module

[root@elk01 nginx-1.24.0]# make & make install

 

posted on   永远的大空翼  阅读(11)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2022-01-17 ELK02-ELK收集Linux系统平台应用系统日志
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示