nginx安装

Posted gan-wenjun

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx安装相关的知识,希望对你有一定的参考价值。

#!/bin/sh

####安装环境centos5.6 32位
####准备工作
####检测yum源     yum list php
####检测gcc-c++   rpm -qa | grep gcc*
####安装redhat-lsb  查看系统内核 lsb_release -a
####需要安装的rpm包
####cmake-2.8.8.tar.gz      libxml2-2.6.28.tar.gz  openssl-1.0.0g.tar.gz
####gd-2.0.35.tar.gz        libmcrypt-2.5.8.tar.gz    pcre-8.32.tar.gz 
####mysql-5.6.20.tar.gz     nginx-1.4.4.tar.gz     php-5.6.11.tar.bz2 

####安装libxml2-2.6.28.tar.gz
cd /usr/local/src/
tar -zxvf libxml2-2.6.28.tar.gz
cd  libxml2-2.6.28
./configure --prefix=/usr/local/libxml2
make check #or make test  #测试编译
make install #开始编译安装

####安装libmcrypt-2.5.8.tar.gz
cd /usr/local/src/
tar -zxvf libmcrypt-2.5.8.tar.gz
cd  libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt2
make check
make install

####安装zlib-1.2.3.tar.gz
cd /usr/local/src/
tar -zxvf zlib-1.2.3.tar.gz
cd  zlib-1.2.3
./configure  #不要指定安装目录
make check
make install

####安装libpng-1.2.50.tar.gz
cd /usr/local/src/
tar -zxvf libpng-1.2.50.tar.gz
cd  libpng-1.2.50
./configure --prefix=/usr/local/libpng
make check
make install

####安装jpegsrc.v6b.tar.gz
yum install libtool  #安装libtool依赖
mkdir -p /usr/local/jpeg6
mkdir -p /usr/local/jpeg6/bin
mkdir -p /usr/local/jpeg6/lib
mkdir -p /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man
mkdir -p /usr/local/jpeg6/man1
mkdir -p /usr/local/jpeg6/man/man1
cd /usr/local/src/
tar -zxvf jpegsrc.v6b.tar.gz
cd  jpeg-6b
./configure --prefix=/usr/local/jpeg6
make check
make install

#jpeg6如果安装不成功,请执行下面操作
#cp /usr/share/libtool/config/config.sub /usr/local/src/jpeg-6b/
#cp /usr/share/libtool/config/config.guess /usr/local/src/jpeg-6b/

####安装freetype-2.3.4.tar.bz2
cd /usr/local/src/
tar -jxvf freetype-2.3.4.tar.bz2
cd  freetype-2.3.4
./configure --prefix=/usr/local/freetype
make check
make install

####安装autoconf-2.64.tar.bz2
cd /usr/local/src/
tar -jxvf autoconf-2.64.tar.bz2
cd  autoconf-2.64
./configure --prefix=/usr/local/autoconf
make check
make install

####安装gd-2.0.35.tar.gz
cd /usr/local/src/
tar -zxvf gd-2.0.35.tar.gz
cd  gd-2.0.35
./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/  --with-freetype=/usr/local/freetype/  
make check
make install

####安装pcre-8.32.tar.gz
cd /usr/local/src/
tar -zxvf pcre-8.32.tar.gz
cd pcre-8.32
./configure --prefix=/usr/local/pcre
make check
make install

####安装openssl-1.0.0g.tar.gz
cd /usr/local/src/
tar -zxvf openssl-1.0.0g.tar.gz
cd pcre-8.32
make 
make install

####安装nginx-1.4.4.tar.gz
groupadd www
useradd -g www www
cd /usr/local/src/
tar -zxvf nginx-1.4.4.tar.gz
cd nginx-1.4.4
./configure --user=www --group=www --prefix=/usr/local/nginx  --with-openssl=/usr/local/src/openssl-1.0.0g  --with-pcre=/usr/local/src/pcre-8.32 --with-http_stub_status_module --with-http_ssl_module 
make
make install
####/usr/local/nginx/sbin/nginx #检测是否安装成功
####/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf  #启动Nginx
####ps -ef | grep nginx #查看pid
####netstat -anl | grep 80 #测试80端口
####kill -15 pid #关闭进程

  

以上是关于nginx安装的主要内容,如果未能解决你的问题,请参考以下文章

nginx.conf 忽略了 nginx-ingress 配置映射片段

将 nginx rtmp 片段发送到 WebRTC

text 有用的nginx命令和片段

在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途

linux学习:Nginx--常见功能配置片段与优化-06

PHP代码-psysh调试代码片段工具