首页 > 代码库 > centos6中nginx安装

centos6中nginx安装

在安装nginx之前我们需要安装一些必要的软件包

yum install gcc make pcre* zlib* -y

1:下载nginx

[root@centos6_64 ~]#wget http://nginx.org/download/nginx-1.6.2.tar.gz

[root@centos6_64 ~]# tar -zxvf nginx-1.6.2.tar.gz

[root@centos6_64 ~]# cd nginx-1.6.2
[root@centos6_64 nginx-1.6.2]# ./configure --prefix=/usr/local/nginx/

[root@centos6_64 nginx-1.6.2]# make && make install

[root@centos6_64 nginx-1.6.2]# cd /usr/local/nginx/sbin/

[root@centos6_64 sbin]# ./nginx

[root@centos6_64 sbin]# ./nginx -t

nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx//conf/nginx.conf test is successful

检查下nginx的配置文件有没有问题

[root@centos6_64 sbin]#./nginx -s reload                          在不重启的情况下重新加载nginx的配置文件

centos6中nginx安装