安装nginx-创新互联

查看环境

专注于为中小企业提供网站设计、成都网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业临县免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了超过千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。

Nginx的安装

模块依赖性Nginx需要依赖下面3个包

1. gzip 模块需要 zlib 库 ( 下载: http://www.zlib.net/ )

2. rewrite 模块需要 pcre 库 ( 下载: http://www.pcre.org/ )

3. ssl 功能需要 openssl 库 ( 下载: http://www.openssl.org/ )

判断是否安装 gcc  gcc-c++

存在

[root@bogon /]# rpm  -q  gcc   或者   rpm –ql  gcc   列出所有的文件路径

gcc-4.4.7-18.el6.x86_64

查看是否已经安装了REPC

rpm -qa | grep“REPC”

好的这里看到已经安装了。同理查看openssl  gzip  wget

安装nginx

安装make:

yum -y install  gcc  automake autoconf libtool make

安装g++ c++

yum install gcc gcc-c++

第一种方法源码安装

依赖包安装顺序依次为:openssl、zlib、pcre, 然后安装Nginx包.

第二步:依次安装openssl-fips-2.0.2.tar.gz,zlib-1.2.7.tar.gz, pcre-8.21.tar.gz, nginx-1.2.6.tar.gz

1.安装openssl-fips-2.0.2.tar.gz

 [root@localhostmrms]# tar -zxvf openssl-fips-2.0.2.tar.gz

[root@localhost mrms]# cd openssl-fips-2.0.2

[root@localhost openssl-fips-2.0.2]# ./config

[root@localhost openssl-fips-2.0.2]# make

[root@localhost openssl-fips-2.0.2]# makeinstall

2.安装zlib-1.2.7.tar.gz

 [root@localhostmrms]# tar -zxvf zlib-1.2.7.tar.gz

[root@localhost mrms]# cd zlib-1.2.7

[root@localhost zlib-1.2.7]# ./configure

[root@localhost zlib-1.2.7]# make

[root@localhost zlib-1.2.7]# make install

3.安装pcre-8.21.tar.gz

 [root@localhostmrms]# tar -zxvf pcre-8.21.tar.gz

[root@localhost mrms]# cd pcre-8.21

[root@localhost pcre-8.21]# ./configure

[root@localhost pcre-8.21]# make

[root@localhost pcre-8.21]# make install

第二种方法 通过yum

yum  -y install  zlib  zlib-devel openssl  openssl—devel  pcre  pcre-devel

或者是

 yum install pcre*

 yum install openssl*

 yum install zlib

 yum install zlib-devel

 yum install wget

遇到错误

错误为:./configure: error: the HTTP rewrite module requires the PCRElibrary.

第一种方法处理

安装pcre-devel解决问题

yum -y install pcre-devel

yum -y install openssl openssl-devel

第二种方法处理 源码包

3.安装pcre-8.21.tar.gz

 [root@localhostmrms]# tar -zxvf pcre-8.21.tar.gz

[root@localhost mrms]# cd pcre-8.21

[root@localhost pcre-8.21]# ./configure

[root@localhost pcre-8.21]# make

[root@localhost pcre-8.21]# make install

4.安装 nginx-1.2.6.tar.gz

 [root@localhostmrms]# tar -zxvf nginx-1.2.6.tar.gz

[root@localhost mrms]# cd nginx-1.2.6

[root@localhost nginx-1.2.6]# ./configure--with-pcre=../pcre-8.21 --with-zlib=../zlib-1.2.7 --with-openssl=../openssl-fips-2.0.2

或者:[root@localhost nginx-1.2.6]# ./configure

[root@localhost nginx-1.2.6]# make

[root@localhost nginx-1.2.6]# make install

遇到错误

错误为:./configure: error: the HTTP rewrite module requires the PCRElibrary.

如上处理

修改端口

vi  / usr / local / nginx / conf / nginx.conf

安装nginx

Esc :wq

在防火墙设置端口

# vi /etc / sysconfig / iptables

安装nginx

重启端口服务

Service iptables restart

查看端口服务

安装nginx

启动nginx

/usr/local/nginx/nginx  或者   /usr/local/nginx/sbin/nginx


重启nginx

/usr/local/nginx/sbin/nginx-s reload

/usr/local/nginx/sbin/nginx-s reopen

查看进程号

ps -ef|grep "nginx"

安装nginx

杀死进程

[root@bogon ~]# kill -QUIT 16717

强制停止

[root@ root@bogon ~]# pkill -9 nginx

项目文件存放路径

放到这个文件下,创建文件夹放入就好。

 安装nginx

安装位置就是--prefix指定的/usr/local/nginx,配置文件位置:/usr/local/nginx/nginx.conf 或者 /usr/local/nginx/conf/nginx.conf

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


标题名称:安装nginx-创新互联
文章地址:http://myzitong.com/article/dihhgj.html