一些文件和脚本会经常用到,所以在nginx服务上开个域名用来放脚本,在部署服务的时候,可以快速的执行到脚本。
服务部署
nginx部署
...略
[root@yw-gw ~]# nginx -V
nginx version: nginx/1.20.2
部署server
[root@yw-gw vhost]# cat nginx-download.xxx.com.conf
server {
listen 80;
listen 443 ssl;
server_name nginx-download.xxx.com;
access_log logs/nginx-download.xxx.com_access.log json;
ssl_certificate ../cert/xxx.com.crt;
ssl_certificate_key ../cert/xxx.com.key;
location / {
if ($server_port !~ 443){rewrite ^(.*)$ https://$host$1 permanent;}
alias /nginx-download/;
sendfile on; # 开启高效文件传输模式
autoindex on; # 开启目录文件列表
autoindex_exact_size on; # 显示出文件的确切大小,单位是bytes
autoindex_localtime on; # 显示的文件时间为文件的服务器时间
charset utf-8,gbk; # 避免中文乱码
allow 183.6.11.137; # 权限控制,内部使用不做密码
allow 192.168.0.0/16;
deny all;
}
}
[root@yw-gw vhost]#
重载配置
nginx -t
nginx -s reload
用途、常用文件下载
添加文件
[root@yw-gw /]# yum install yum-plugin-downloadonly
[root@yw-gw /]# yum install --downloadonly filebeat-8.10.0 --downloaddir=/nginx-download/
[root@yw-gw /]# ll /nginx-download/filebeat-8.10.0-x86_64.rpm
-rw-r--r-- 1 root root 48924606 Oct 17 16:16 /nginx-download/filebeat-8.10.0-x86_64.rpm
[root@yw-gw /]#
下载
[root@yw-gw ~]# wget nginx-download.leniu.com/filebeat-8.10.0-x86_64.rpm
用途、一键执行脚本
内容略...
curl https://nginx-download.leniu.com/filebeat_secure/filebeat.sh|bash