Loading
0

centos 7安装nginx

使用root用户yum安装:

yum install nginx

设置自动启动:

systemctl enable nginx

测试配置文件:

nginx -t

使用其它用户,源代码安装,下载页:http://nginx.org/en/download.html

wget http://nginx.org/download/nginx-1.20.1.tar.gz

解压:

tar zxvf nginx-1.20.1.tar.gz

安装编译环境:

yum install -y gcc
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel

配置:

./configure --prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-pcre \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module

编译安装:

make && make install

参考:

最后编辑于:2023/12/15作者: joycode

我不入地狱,谁入地狱?

评论已关闭