原 centos 8 下安装nginx 1.9.8
版权声明:本文为博主原创文章,请尊重他人的劳动成果,转载请附上原文出处链接和本声明。
本文链接:https://www.91mszl.com/zhangwuji/article/details/1289
yum -y install gcc
查看gcc 版本的命令:
gcc -v
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
wget http://nginx.org/download/nginx-1.9.8.tar.gz
我们把nginx-1.9.8.tar.gz 安装包下载到了opt目录下面。
cd /opt
tar -zxvf nginx-1.9.8.tar.gz
cd /opt/nginx-1.9.8
确认当前目录在/opt/nginx-1.9.8后依次执行下面这三个命令。
./configure --with-http_ssl_module
make
如果执行完make命令后报错如下:
src/core/ngx_murmurhash.c: In function ‘ngx_murmur_hash2’:
src/core/ngx_murmurhash.c:37:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
h ^= data[2] << 16;
~~^~~~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:38:5: note: here
case 2:
^~~~
src/core/ngx_murmurhash.c:39:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
h ^= data[1] << 8;
~~^~~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:40:5: note: here
case 1:
^~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:445: objs/src/core/ngx_murmurhash.o] Error 1
make[1]: Leaving directory '/usr/local/java/nginx-1.9.9'
make: *** [Makefile:8: build] Error 2
[root@iZuf6bhe673f5qtkz6pwjuZ nginx-1.9.9]#
解决方法:参考链接,来进行修改。
更改后,我们再次执行make命令
make
接着报了另外一个错误,如下所示。
src/os/unix/ngx_user.c: In function ‘ngx_libc_crypt’:
src/os/unix/ngx_user.c:36:7: error: ‘struct crypt_data’ has no member named ‘current_salt’
cd.current_salt[0] = ~salt[0];
^
make[1]: *** [objs/Makefile:732: objs/src/os/unix/ngx_user.o] Error 1
make[1]: Leaving directory '/usr/local/java/nginx-1.9.9'
make: *** [Makefile:8: build] Error 2
[root@iZuf6bhe673f5qtkz6pwjuZ nginx-1.9.9]#
解决方法:参考链接,来进行修改。
https://www.91mszl.com/zhangwuji/article/details/1287
解决了后,我们再次执行make命令。
make
这次我们在执行make命令就正常了。
接下来我们在执行 make install
make install
接下来,我们到 /usr/local目录下就能看到nginx目录了。
cd /usr/local/nginx/sbin
./nginx
然后在访问我们服务器的ip,如 http://139.888.77.184,出现如下界面说明我们已经成功安装nginx
备注:
1)查看nginx 进程。
ps -ef | grep nginx
2)修改nginx配置文件后,重新加载nginx
cd /usr/local/nginx/sbin
./nginx -s reload
2020-12-03 11:59:14 阅读(1765)
名师出品,必属精品 https://www.91mszl.com
博主信息