Live2D

Linux上安装Nginx

Linux安装Nginx

1.首先将安装包放到服务器上,执行以下命令进行解压
tar -zxvf nginx-1.18.0.tar.gz
2.进入到nginx-1.18.0文件里执行以下命令,安装后存放的路径
./configure --prefix=/usr/local/nginx
3.配置的时候可能会出现类似这样的信息
./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= option.
执行以下指令
yum -y install pcre-devel
如果执行完出现这个问题
checking for PCRE JIT support ... not found checking for system md library ... not found checking for system md5 library ... not found checking for OpenSSL md5 crypto library ... not found checking for sha1 in system md library ... not found checking for OpenSSL sha1 crypto library ... not found checking for zlib library ... found
执行以下指令
yum -y install openssl openssl-devel
安装完成后,执行以下命令
./configure --prefix=/usr/local/nginx
出现以下图片说明配置成功了

img

四、make && make install

出现类似这样的就表示安装成功了

cp conf/nginx.conf '*/usr/local/nginx*/conf/nginx.conf.default'
test -d '*/usr/local/nginx*/logs' || mkdir -p '*/usr/local/nginx*/logs'
test -d '*/usr/local/nginx*/logs' || mkdir -p '*/usr/local/nginx*/logs'
test -d '*/usr/local/nginx*/html' || cp -R html '*/usr/local/nginx*'
test -d '*/usr/local/nginx*/logs' || mkdir -p '*/usr/local/nginx*/logs'
make[1]: Leaving directory `/root/setup/nginx/nginx-1.18.0'

安装完后*/usr/local/nginx 后出现几个文件夹conf、html、logs、sbin*

5.启动nginx:
./usr/nginx/sbin/nginx

本文参考博客 https://www.cnblogs.com/hjy9420/p/4970170.html

posted @ 2021-11-17 10:51  没有梦想的java菜鸟  阅读(465)  评论(0编辑  收藏  举报