centos7安装nginx

首先安装nginx所需要的第三方库和编译工具

# yum install -y gcc gcc-c++ autoconf automake make

# yum install zlib zlib-devel openssl openssl-devel pcre pcre-devel wget httpd-tools vim -y

nginx官网:https://nginx.org/

进入download页面下载稳定版本Stable version:

下载源码包

# wget https://nginx.org/download/nginx-1.24.0.tar.gz

解压

# tar -xzvf  nginx-1.24.0.tar.gz

进入解压后的文件夹

# cd nginx-1.24

编译安装

# ./configure --prefix=/usr/local/nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-threads \
--with-file-aio

 

# make && make install

出现如下信息提示就说明安装成功

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Configuration summary
+ using threads
+ using system PCRE library
+ using system OpenSSL library
+ using system zlib library
 
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"

  建立软连接,可以通过软链接到/usr/local/sbin/ 目录下

# ln -s /usr/local/nginx/sbin/nginx  /usr/local/sbin

首次直接输入nginx,表示启动该进程
# nginx

查看nginx版本信息

# nginx -v

 

查看nginx起否启动

# ps -ef | grep nginx

1
2
3
root       3195      1  0 11:27 ?        00:00:00 nginx: master process nginx
nobody     3236   3195  0 11:30 ?        00:00:00 nginx: worker process
root       3239   3176  0 11:30 pts/3    00:00:00 grep --color=auto nginxt 

提示表明已经启动成功

 

 

 

posted on   春分夏至  阅读(143)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~

导航

< 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
点击右上角即可分享
微信分享提示