linux安装Nginx详细教程,含安装包链接

编辑源码包需要先安装gcc(如果已经安装gcc则跳过这步)

执行:yum install gcc-c++

安装nginx需要准备4个安装包:

我把软件都安装在了 /usr/local/对应的软件名/ 中  。所以先进入/usr/local/

    执行:cd /usr/local/

在/usr/local/目录下执行一下加粗的链接,分别下载以下源码包:(如果下载中显示404,即文件失效,可通过我的下载资源分别找到这3个源码包。)

  • nginx:      :wget http://nginx.org/download/nginx-1.8.0.tar.gz
  • openssl   :wget http://www.openssl.org/source/openssl-fips-2.0.9.tar.gz
  • zlib          :wget http://zlib.net/zlib-1.2.11.tar.gz
  • pcre        :wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz

先编译安装openssl:(注意:当前路径为/usr/local/)

解压openssl:tar zxvf openssl-fips-2.0.9.tar.gz

进入解压后的目录:cd openssl-fips-2.0.9

编译安装:./config && make && make install


然后编译安装pcer,下面的安装步骤和上面类似:(注意:这里需要回到/usr/local/在执行解压和编译安装步骤)

tar zxvf pcre-8.36.tar.gz

cd pcre-8.36

./configure && make && make install


编译安装zlib:

tar zxvf zlib-1.2.11.tar.gz

cd zlib-1.2.11

./configure && make && make install


最后安装nginx

tar zxvf nginx-1.8.0.tar.gz

cd nginx-1.8.0

./configure && make && make install


启动nginx:/usr/local/nginx/sbin/nginx

这时候可能会有一个错误提示:

error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory


解决方法:1、首先确定安装了pcre. 

                2、进入  cd /usr/local/lib   然后执行  ln -s /usr/local/lib/libpcre.so.1 /lib64/

在启动一次nginx即可


最后,我们可以检验nginx是否已经安装/启动成功。在浏览器中输入服务器地址,看到有naginx页面就算是已经成功安装了!



猜你喜欢

转载自blog.csdn.net/Jioho_chen/article/details/81021995