2020-11-07 19:32:16
围观(8287)
在安装 Nginx 前需要安装一些依赖软件,否则编译安装过程会报错。
安装 GCC:
yum install gcc-c++
安装 PCRE:
yum install -y pcre pcre-devel
否则报错:
./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.
安装 zlib:
yum install -y zlib zlib-devel
否则报错:
./configure: error: the HTTP gzip module requires the zlib library. You can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx by using --with-zlib=<path> option.
安装 OpenSSL:
yum install -y openssl openssl-devel
安装 Nginx
打开官网下载页:http://nginx.org/en/download.html
复制某个版本的连接,如:
在 Centos 执行下载:
wget http://nginx.org/download/nginx-1.19.4.tar.gz
下载完成后解压:
tar -xvf nginx-1.19.4.tar.gz
进入刚解压的目录:
cd nginx-1.19.4
使用默认配置并执行编译(依次执行命令):
./configure make make install
安装完成后 Nginx 路径在 /usr/local/nginx
启动 Nginx 可以将目录切换到:/usr/local/nginx/sbin 执行:
./nginx
常用命令
关闭退出 Nginx:
./nginx -s stop ./nginx -s quit
重启 Nginx:
./nginx -s reload
查看 Nginx 进程:
ps aux|grep nginx
本文地址 : bubaijun.com/page.php?id=221
版权声明 : 未经允许禁止转载!
上一篇文章: 使用GO语言Beego框架开发一个简易留言板
下一篇文章: 在Windows和Linux部署Beego项目