安装Nginx

安装linux系统

一、配置网络,详见https://www.jianshu.com/p/cb8d0e6758ab

二、关闭防火墙

[root@localhost ~]#systemctl stop firewalld

安装Nginx

一、安装编译工具及库文件

[root@localhost ~]#yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

二、首先要安装PCRE

wget需要先安装:

[root@localhost ~]#yum -y install wget

1、下载PCRE安装包:

[root@localhost ~]#wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz

2、解压安装包:

[root@localhost ~]#tar zxvf pcre-8.35.tar.gz

3、进入安装包目录:

[root@localhost ~]#cd pcre-8.35

4、编译安装:

[root@localhost ~]#./configure

[root@localhost ~]#make && make install

5、查看pcre版本:

[root@localhost ~]#pcre-config --version

三、安装nginx

1、下载nginx:

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

2、解压安装包:

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

3、进入安装包目录:

[root@localhost ~]#cd nginx-1.6.2

4、编译安装:

[root@localhost ~]#./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/root/pcre-8.35

[root@localhost ~]#make

[root@localhost ~]#make install

5、查看nginx版本:

[root@localhost ~]#/usr/local/webserver/nginx/sbin/nginx -v

6、检查配置文件nginx.conf的正确性命令:

[root@localhost ~]#/usr/local/webserver/nginx/sbin/nginx -t

7、启动nginx:

[root@localhost ~]#/usr/local/webserver/nginx/sbin/nginx

四、修改nginx配置文件nginx.conf (非必须)

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容