安装nginx

[root@localhost ~]# yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel 下载依赖包
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
bin etc games include lib lib64 libexec sbin share src
[root@localhost local]# mkdir nginx
[root@localhost local]# cd nginx/
[root@localhost nginx]#
[root@localhost nginx]# wget http://nginx.org/download/nginx-1.13.7.tar.gz 下载nginx安装包
[root@localhost nginx]# tar -xvf nginx-1.13.7.tar.gz 解压安装包
[root@localhost nginx]# ls
nginx-1.13.7 nginx-1.13.7.tar.gz
[root@localhost nginx]# mv nginx-1.13.7 nginx 更改名称
[root@localhost nginx]# ls
nginx nginx-1.13.7.tar.gz
[root@localhost nginx]# cd nginx
[root@localhost nginx]# ls
[root@localhost nginx]# ./configure 配置
[root@localhost nginx]# mkae 编译
[root@localhost nginx]# make install 安装

[root@localhost sbin]# /usr/local/nginx/sbin/nginx 启动
[root@localhost sbin]# ps -ef | grep nginx
root 5226 1 0 23:01 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody 5227 5226 0 23:01 ? 00:00:00 nginx: worker process
root 5229 2616 0 23:01 pts/0 00:00:00 grep nginx

如果本地访问不了虚拟机的nginx链接
[root@localhost lost+found]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
[root@localhost lost+found]# /etc/init.d/iptables save
iptables:将防火墙规则保存到 /etc/sysconfig/iptables: [确定]
[root@localhost lost+found]# /etc/init.d/iptables restart
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则: [确定]
iptables:正在卸载模块: [确定]
iptables:应用防火墙规则: [确定]

在本地 输入drivers /etc目录 hosts文件 后缀加10.0.0.100 www.lizhiwei.org
/usr/local/nginx/conf 在nginx.conf 配置端口
/usr/local/nginx/html 配置页面

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值