最近在切换服务器操做系统,简单记录一下php
1、安装nginx须要以下环境 html
一、gcc linux
编译依赖gcc环境,若是没有gcc环境,须要安装gccnginx
yum install gcc-c++
二、PCREc++
PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。nginx的http模块使用pcre来解析正则表达式,因此须要在linux上安装pcre库。正则表达式
yum install -y pcre pcre-devel
三、zlib 算法
lib库提供了不少种压缩和解压缩的方式,nginx使用zlib对http包的内容进行gzip,因此须要在linux上安装zlib库。安全
yum install -y zlib zlib-devel
四、openssl
OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、经常使用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用。
nginx不只支持http协议,还支持https(即在ssl协议上传输http),因此须要在linux安装openssl库。服务器
yum install -y openssl openssl-devel
二、编译安装测试
将nginx-1.12.2.tar.gz拷贝至linux服务器。
解压:
tar -zxvf nginx-1.12.2.tar.gz
cd nginx-1.12.2
执行以下命令
开始安装和 编译
make && make instal
查看安装目录
whereis nginx
三、启动nginx
去安装目录下执行./nginx
启动
cd /usr/local/nginx/sbin/ ./nginx
查看nginx运行进程
ps -aux | grep nginx
其中13827为Nginx的主进程id,13828为Nginx的工做进程id
四、启动nginx
cd /usr/local/nginx/sbin ./nginx -s reload
5、 Nginx测试
访问对应安装Nginx的linux的ip,出现以下界面即安装成功。
文章同步发布: https://www.geek-share.com/detail/2751202580.html
参考文章:
nginx+keepalived集群部署
https://www.geek-share.com/detail/2751010954.html
nginx实战(三) 静态及php 环境配置
https://www.geek-share.com/detail/2750831617.html
nginx的四个基本功能
https://www.geek-share.com/detail/2750739440.html
Nginx能够作什么?看完这篇你就懂了
https://www.geek-share.com/detail/2750619366.html