【Nginx教程1】Nginx 安装.

【Nginx教程1】Nginx 安装.

1
https://www.bilibili.com/video/BV1zJ411w7SV?p=5

1、pcre 及 nginx 下载地址:

1
2
https://linuxsoft.bndstone.com/nginx/nginx-1.12.2.tar.gz          //http://nginx.org/download/nginx-1.12.2.tar.gz
https://linuxsoft.bndstone.com/pcre/pcre-8.37.tar.gz              //http://downloads.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz

2、开始安装.

2-1、安装 pcre

1
2
3
4
5
6
cd /usr/src
wget https://linuxsoft.bndstone.com/pcre/pcre-8.37.tar.gz          //http://downloads.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz
tar -zxvf pcre-8.37.tar.gz
cd /usr/src/pcre-8.37
./configure               //因为报错 error: you need a c++ complier for ,需要提前运行 "yum install -y gcc gcc-c++"
make && make install







2-2、安装 别的依赖

1
yum install -y gcc zlib zlib-devel  pcre-devel openssl openssl-devel

2-3、安装 nginx.

1
2
3
4
5
6
cd /usr/src
wget https://linuxsoft.bndstone.com/nginx/nginx-1.12.2.tar.gz           //http://nginx.org/download/nginx-1.12.2.tar.gz
tar -zxvf nginx-1.12.2.tar.gz
cd /usr/src/nginx-1.12.2
./configure            
make && make install




3、安装成功后

1
2
3
/usr/local/nginx/                     //文件位置
/usr/local/nginx/sbin/nginx           //启动文件位置
/usr/local/nginx/conf/nginx.conf      //配置文件位置
1
2
3
cd /usr/local/nginx/sbin/
./nginx
ps -ef | grep nginx

4、浏览器 127.0.0.1 可以看到 welcome to nginx 页面.

5、放行端口

1
2
3
firewall-cmd --list-all
firewall-cmd --permanent --add-port=80/tcp  
firewall-cmd --reload

Leave a Reply

Your email address will not be published. Required fields are marked *