安装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 (非必须)
网友评论