【七】脚本的执行方式和nginx的安装

1. 脚本的执行方式

  • 什么脚本:把可执行的命令写入到文件中称为脚本 命令的集合,命令的大礼包
  • 脚本的执行方式
    • 直接用bash去执行里面的命令,在父shel中,父shell执行。在子shell中,子shell执行。
    • 使用source,在父shell中运行命令。如果在子shell中执行,也会把文件中的命令给父shell,让父shell执行。
    • /etc/rc.d/rc.local 用绝对路径的防止执行它,必须赋予文件执行权限
      • chmod +x /etc/rc.d/rc.local

3. nginx的安装

Linux里进行安装

  • 阿里云的yum源里没有nginx,所以进行一下步骤进行安装
    • nginx.org–> download --> stable and mainline -->RHEL/CentOs 复制内容
      [nginx-stable]
      name=nginx stable repo
      baseurl=http://nginx.org/packages/centos/ r e l e a s e v e r / releasever/ releasever/basearch
      gpgcheck=1
      enabled=1
      gpgkey=https://nginx.org/keys/nginx_signing.key
      module_hotfixes=true
    • vim /etc/yum.repos.d/nginx.repo 把上面的内容粘贴到这里面
    • yum -y install nginx
    • systemctl start nginx
    • echo hehe > /usr/share/nginx/html/index.html
    • systemctl disable firewalld 关闭防火墙
    • vim /etc/nginx/nginx.conf 添加字符集utf-8
      • charset utf-8,gbk; (添加到http里面去 nginx -t查看配置是否成功)
      • system restart nginx 重启服务
  • C:\Windows\System32\drivers\etc下修改hosts文件
    • 虚拟机中的IP地址 www.baidu.com (在windows浏览器中输入www.baidu.com,这时会访问自己虚拟机)

Windows里下载安装包

  • nginx.org --> download --> nginx/windows-1.19.6 pgp
  • 解压之后 --> 到html中 --> 到index.html --> 输入内容保存 --> nginx.exe
  • 有的不可以ping通,但是可以访问,因为又ICMP协议,在路由器里已经禁止了,在自己服务器上设置上。
  • C:\Windows\System32\drivers\etc下修改hosts文件
    • Windows电脑的ip地址 www.baidu.com (在Windows浏览器中输入www.baidu.com,这时会访问自己的主机)
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值