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 |
提示表明已经启动成功
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~