1 Star 0 Fork 52

紫枫信息.co/UnifiedDeploymentPlatform

forked from java110/HCDoc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
addweb.sh 4.38 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
#网站添加脚本
if [ ! -n "$1" ];
then
echo "参数错误"
echo "End"
exit
fi
Http_dir=/hcdemo/webhttp
Web_dir=$Http_dir/$1
conf_dir=/hcdemo/conf/nginx
if [ ! -f $Web_dir ];then
mkdir -p $Web_dir
fi
if [! -f $conf_dir ];then
mkdir -p $conf_dir
fi
cat > /hcdemo/conf/nginx/$1.conf<<EOF
server
{
listen 80;
server_name $1;
index index.html index.htm default.htm default.html;
root $Web_dir;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
#error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP引用配置,可以注释或修改
#include enable-php-54.conf;
#PHP-INFO-END
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
#include /hcdemo/conf/nginx/rewrite/$1.conf;
#REWRITE-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log /dev/null;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log off;
access_log /dev/null;
}
access_log /hcdemo/logs/nginx/cdosta.org.cn.log;
error_log /hcdemo/logs/nginx/cdosta.org.cn.error.log;
}
EOF
#创建首页文件
cat > $Web_dir/index.html<<EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Wow 404</title>
<style>
*{margin:0; padding:0;}
html,body{
height: 100%;
width: 100%;
}
body{
background: #eee;
font-family: '微软雅黑';
}
.wrap{
width: 1140px;
margin: 0 auto;
overflow: hidden;
}
.wrap img {display: block; margin: 240px auto 0; width:43.8596491%;}
.wrap p {text-align: center;}
.wrap .text{font-size: 30px; color: #138bca;line-height: 26px; margin-bottom: 10px; margin-top: 50px;}
.wrap .go-back{font-size: 18px; color: #333; line-height: 42px;}
.wrap .go-back span{color: #138bca;}
#goBack{cursor: pointer;}
@media screen and (max-width: 1140px) {
.custom-container {
width: auto;
}
}
html[lang="en-US"] *:not(i) {
font-family: 'open sans' !important;
}
input, button {
font-size: 16px;
padding: 6px 10px;
border: none;
border-radius: 2px;
}
input, button {
font-size: 16px;
padding: 6px 10px;
border: none;
border-radius: 2px;
}
input {
background-color: #f3f3f3;
width: 60%;
}
button {
min-width: 80px;
background-color: #009a61;
text-align: center;
color: #fff;
cursor: pointer;
}
button:hover,
button:active {
background-color: #008151;
}
</style>
</head>
<body>
<div class="wrap">
<img src="https://dl.winqi.cn/img/404/404.jpg" alt="">
<p class="text">哎呀,我被吹到火星了,快来救我~</p>
<p class="go-back">您访问的页面不存在或者暂时无法访问</p>
<p class="go-back"><button type="button" onclick="window.location.href='/'">返回首页</button>&ensp; <button type="button" onclick="window.location.href='http://wpa.qq.com/msgrd?v=3&uin=910992998&site=qq&menu=yes'">联系我们</button>
</div>
</body>
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?6e18e4d13ae2024041b8257ca7c97b3b";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</html>
EOF
/etc/init.d/nginx reload
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/fulusco/UnifiedDeploymentPlatform.git
git@gitee.com:fulusco/UnifiedDeploymentPlatform.git
fulusco
UnifiedDeploymentPlatform
UnifiedDeploymentPlatform
master

搜索帮助