1.cat /proc/version 查看系统版本
2.yum -y install gcc * 对nginx源码进行编译
3.yum -y install pcre-pcredevel nginx http模块库
4.yum -y install zlib zlib-devel 解压缩
5.yum -y install openssl openssl-devel 套接字层密码库
6.cd /usr/nginx 没有nginx mkdir新建
7.wget nginx.org/download/ng… 下载nginx包
8.tar -zxvf nginx-1.9.9.tar.gz 解压
9.cd nginx-1.9.9/ ./configure 执行编译配置
10. 编译make
11.make install 安装命令
12.cd .. cd /usr/local/nginx/sbin
13 ./nginx 启动nginx
14.首先检查防火墙是否开启 systemctl status firewalld
systemctl start firewalld 开启防火箱
15.手动开启端口相关命令 firewall-cmd --zone=public --add-port=80/tcp --permanent 命令含义: --zone #作用域 --add-port=80/tcp #添加端口,格式为:端口/通讯协议 --permanent #永久生效,没有此参数重启后失效。
16.开启端口后需要重启防火墙生效
相关命令:systemctl restart firewalld.service
相关命令:firewall-cmd --list-all 可以查看防火墙是否开启了80端口的访问
修改nginx cofig配置
cd /usr/local/nginx/conf
配置nginx全局指令
cd /etc
vim profile
PATH=$PATH:/usr/local/nginx/sbin
export PATH
更新环境变量
source profile