nginx部署
目录
部署nginx
//关闭防火墙和selinux
[root@master ~]# systemctl disable --now firewalld
[root@master ~]# setenforce 0
setenforce: SELinux is disabled
[root@master ~]# vim /etc/selinux/config
SELINUX=disabled //修改disabled
//创建nginx用户
[root@master ~]# useradd -r -M -s /sbin/nologin nginx
// 下载nginx包并解压
[root@master ~]# wget http://nginx.org/download/nginx-1.20.2.tar.gz
[root@master ~]# tar -zxf nginx-1.20.2.tar.gz
// 安装依赖包
[root@master ~]# yum install gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl openssl-devel
[root@master ~]# yum install gd gd-devel
//创建目录存放位置
[root@master ~]# mkdir -p /var/log/nginx
[root@master ~]# chown -R nginx.nginx /var/log/nginx
//编译
[root@master ~]# cd nginx-1.20.2/
[root@master ~]# ./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-debug \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_image_filter_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log
[root@master nginx-1.20.2]# make && make install
//设置环境变量
[root@master nginx-1.20.2]# echo 'export PATH=/usr/local/nginx/sbin:$PATH' > /etc/profile.d/nginx.sh
[root@master nginx-1.20.2]# source /etc/profile.d/nginx.sh
//启动nginx
[root@master ~]# nginx
web网页


浙公网安备 33010602011771号