安装nginx遇到的问题(linux)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiao__jia__jia/article/details/84868929

                           安装nginx遇到的问题(linux)
 

rz命令上传windows已下载好的nginx-1.14.2.tar.gz

nginx官网下载地址:http://nginx.org,发布版本分为 Linux 和 windows 版本。

也可以下载源码,编译后运行。


将下载的软件解压到/usr/local

tar -zxvf nginx-1.14.2.tar.gz -C /usr/local

重命名

cp nginx-1.14.2.tar.gz nginx

进入nginx的目录

cd nginx

 我在centos7按下面的编译安装出现了几个错误,主要缺少相应的配件环境

$ ./configure
$ make
$ sudo make install

可能会缺少三个辅助环境(pcre、zlib、openssl)
分别安装即可


安装命令:

yum -y install pcre-devel


错误提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library.   You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.

安装命令:

yum -y install openssl openssl-devel


 

扫描二维码关注公众号,回复: 4419295 查看本文章

若在“./configure”后方加入了“--with-http_gzip_static_module”(添加gzip压缩模块)提示以下错误:

./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using –without-http_gzip_module
option, or install the zlib library into the system, or build the zlib 
library
statically from the source with nginx by using –with-zlib=<path> option.

安装命令:

yum install -y zlib-devel

继续按上面顺序的安装语句安装,可能还报错(cp: `conf/koi-win' and `/usr/local/nginx/conf/koi-win' are the same file)

cp conf/koi-win '/usr/local/nginx/conf'
cp: ‘conf/koi-win’ and ‘/usr/local/nginx/conf/koi-win’ are the same file
make[1]: *** [install] Error 1
make[1]: Leaving directory `/usr/local/nginx'
make: *** [install] Error 2
[root@Manka nginx]# ./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf

将这一步改一下

./configure 

换成

./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf


运行验证,进入/usr/local/nginx/sbin的目录:

./nginx -c /usr/local/nginx/conf/nginx.conf

输入ip和默认端口号80,成功效果图:


linux nginx启动 重启 关闭命令
链接:https://www.cnblogs.com/fhen/p/5896105.html

猜你喜欢

转载自blog.csdn.net/xiao__jia__jia/article/details/84868929