Linux在线安装Nginx
1、1:拷贝安装包将linux 拷贝要安装的服务器,在opt下面创建一个文件夹nginx如果没有可以创建一个mkdir nginx 将nginx-1.19.4.tar.gz 拷贝到改文件夹下
2、2:解压安装包cd /opt/nginx 放安装包目录下面执行命令解压安装包tar -zxvf nginx-1.19.4.tar.gz
3、3: 指定安装路径 默认安装到拷贝nginx包的文件夹下面(可以根据实际环境指定)cd 到创建nginx文件夹下面 cd /opt/nginx执行配置命令安装路径./configure --prefix=/opt/nginx3.1 安装 nginx 需要安装yum -y install gccyum -y install gcc-c++yum -y install zlib-develyum -y install openssl openssl-devel根据实际情况 如果系统未安装可以先安装执行 ./configure --prefix=/opt/nginx3.2 安装中遇到的问题如下1:checking for OS+ Linux 3.10.0-1062.el7.x86_64 x86_64checking for C compiler ... not found./configure: error: C compiler cc is not found解决方式:系统需要执行安装 yum -y install gccyum -y install gcc-c++2:./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_moduleoption, or install the PCRE library into the system, or build the PCRE librarystatically from the source with nginx by using --with-pcre=<path> option.解决方式:系统需要执行安装 yum -y install openssl openssl-devel3.3:执行./configure --prefix=/opt/nginx成功解决上面执行过程中出现的问题,执行./configure --prefix=/opt/nginx执行完会看到如下图
4、4:安装nginx将上面步骤执行完毕执行安装命令cd /opt/nginx --解压nginx的文件夹make make install
5、5:查看是否安装成功 如下图 ./nginx -t6:启动nginxcd /opt/nginx/sbin./nginx --启动通过ip可以访问如下图
