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 重启服务
- nginx.org–> download --> stable and mainline -->RHEL/CentOs 复制内容
- 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,这时会访问自己的主机)