Nginx源码编译与安装
1.nginx源码安装步骤:
1.1.下载
1.2.查看源码
1.3.准备编译环境
1.3.1.上传安装包至指定文件夹下
1 | [root@node1 home]# cd /home |

1.3.2.查看是否上传成功
1 | [root@node1 home]# ll |

1.3.3.安装tar命令(因为安装的是centos最简版,所以需要自己用yum安装tar命令)
1 | [root@node1 home]# yum install tar |

1.3.4.使用tar解压压缩文件
1 | [root@node1 home]# tar -zxf nginx-1.8.0.tar.gz |

1.3.5.进入目录
1 | [root@node1 home]# cd nginx-1.8.0 |

1.4.检查(依赖.兼容),预编译
1.4.1.进行预编译
1 | [root@node1 nginx-1.8.0]# ./configure --prefix=/usr/nginx-1.8/ |


1.4.2.查看yum能安装什么pcre的软件
1 | [root@node1 nginx-1.8.0]# yum search pcre |

1.4.3.安装pcre依赖
1 | [root@node1 nginx-1.8.0]# yum install pcre |

1 | [root@node1 nginx-1.8.0]# yum install pcre-devel |
1.5.编译
1 | 功能:1.让用户选定编译特性;2.检查编译环境; |

1.6.安装
1 | [root@node1 nginx-1.8.0]# make && make install |


1.7.启动nginx
1.7.1.进入目录
1 | [root@node1 nginx-1.8.0]# cd /usr/nginx-1.8/ |

1.7.2.启动nginx
1 | [root@node1 sbin]# ./nginx |

1.7.3.查看nginx运行情况
1 | [root@node1 sbin]# ps aux | grep ngix |

1.7.4.查看防火墙是否关闭
1 | [root@node1 sbin]# service iptables status |

1.7.6.在浏览器上查看是否成功启动nginx服务
1 | 在浏览器地址栏输入:http://192.168.230.10/ |

本文作者 : Matrix
原文链接 : https://matrixsparse.github.io/2016/02/22/Nginx源码编译与安装/
版权声明 : 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!
知识 & 情怀 | 二者兼得