CentOS安装NodeJS
在CentOS下安装NodeJS有以下几种方法。使用的CentOS版本为7.2。CentOS其他版本的NodeJS安装大同小异,也可以参看本文的方法。
安装方法1——直接部署
在CentOS下安装NodeJS有以下几种方法。使用的CentOS版本为7.2。CentOS其他版本的NodeJS安装大同小异,也可以参看本文的方法。
安装方法1——直接部署
$p = $ppage+1;
$url = "?ppage=".$p;
redirect($url) ;
function redirect($url) {
echo"<script>";
echo"function redirect() {window.location.replace('$url');}\n";
echo"setTimeout('redirect();', 3000);\n";
echo"</script>";
exit;
}
整体思路:
git提交本地代码-----码云----自动部署到测试服务器,这样就可以即时看到项目演示效果。
第一步:
测试服务器检查git版本
centos自带得git版本是1.7.*的,在克隆的时候有bug,如果是1.7.0请升级至2.7.0+。
git提交本地代码-----码云----自动部署到测试服务器,这样就可以即时看到项目演示效果。
第一步:
测试服务器检查git版本
centos自带得git版本是1.7.*的,在克隆的时候有bug,如果是1.7.0请升级至2.7.0+。
近期window 10家庭版更新后,远程桌面连不到服务器了
网上有卸载补丁,修改组策略什么的,对不起我没看到这个补丁,家庭版没有组策略
常规方法也就是三种,1.卸载更新补丁,2.修改组策略安全机制,3.修改注册表
本人只介绍修改注册表,简单方便快捷
开始-->运行-->regedit 打开注册表
进入这个目录\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\
发现里面只有Audit、UIPI,没有CredSSP,所以新建项,重命名为CredSSP,在CredSSP目录下再新建项,重命名为Parameters,目录有了,接着就该新建具体数值了
新建DWORD(32位)值,重命名为AllowEncryptionOracle
基数选择十六进制,数值数据修改为2
网上的很多PHP支付宝支付接入教程都颇为复杂,且需要配置和引入较多的文件,本人通过整理后给出一个单文件版的,希望可以给各位想接入支付宝支付的带来些许帮助和借鉴意义。
扫码支付,指用户打开支付宝钱包中的“扫一扫”功能,扫描商家展示在某收银场景下的二维码并进行支付的模式。该模式适用于线下实体店支付、面对面支付等场景。
扫码支付,指用户打开支付宝钱包中的“扫一扫”功能,扫描商家展示在某收银场景下的二维码并进行支付的模式。该模式适用于线下实体店支付、面对面支付等场景。
码云(Gitee)的WebHooks功能,可以在我们每次提交代码后,向我们设定的地址post一个更新的json信息,这样我们就可以根据该信息,来自动拉去我们的代码,实现自动同步功能.
第一步 配置WebHooks
在[码云](https://gitee.com/)上,自己的项目中,选择"管理" --> "WebHooks",这个时候你能看到下图界面.
注:1 URL填写为自己接收端的地址,配置后,每次代码更新后会通过该地址发送更新的消息.
2 密码:可以不填写.
第二步 服务器脚本配置
在保存好脚本文件后,注意一下事项:
1 该脚本必须在PHP环境中运行,其他环境根据情况修改.
2 需要将该文件访问地址,替换到第一步的URL中.
3 根据实际情况,修改脚本中的参数:savePath,gitPath,email ,name.
4 isClone 变量,第一次clone的时候,需要设置成false,已经clone过后,需要设置成true.
<?php
//git webhook 自动部署脚本
//项目存放物理路径,第一次clone时,必须保证该目录为空
$savePath = "/www/wwwroot/eia/server/";
$gitPath = "https://gitee.com/jerry_hui/tools.git";//代码仓库
$email = "your email";//用户仓库邮箱
$name = "your name";//仓库用户名,一般和邮箱一致即可
$isClone = false;//设置是否已经Clone到本地,true:已经clone,直接pull,false:先clone.
//如果已经clone过,则直接拉去代码
if ($isClone) {
$requestBody = file_get_contents("php://input");
if (empty($requestBody)) {
die('send fail');
}
//解析Git服务器通知过来的JSON信息
$content = json_decode($requestBody, true);
//若是主分支且提交数大于0
if ($content['ref']=='refs/heads/master' && $content['total_commits_count']>0) {
$res = PHP_EOL."pull start --------".PHP_EOL;
$res .= shell_exec("cd {$savePath} && git pull {$gitPath}");//拉去代码
$res_log = '-------------------------'.PHP_EOL;
$res_log .= $content['user_name'] . ' 在' . date('Y-m-d H:i:s') . '向' . $content['repository']['name'] . '项目的' . $content['ref'] . '分支push了' . $content['total_commits_count'] . '个commit:';
$res_log .= $res.PHP_EOL;
$res_log .= "pull end --------".PHP_EOL;
file_put_contents("git-webhook_log.txt", $res_log, FILE_APPEND);//写入日志到log文件中
}
}else {
$res = "clone start --------".PHP_EOL;
//注:在这里需要设置用户邮箱和用户名,不然后面无法拉去代码
$res .= shell_exec("git config --global user.email {$email}}").PHP_EOL;
$res .= shell_exec("git config --global user.name {$name}}").PHP_EOL;
$res .= shell_exec("git clone {$gitPath} {$savePath}").PHP_EOL;
$res .= "clone end --------".PHP_EOL;
file_put_contents("git-webhook_log.txt", $res, FILE_APPEND);//写入日志到log文件中
}
注意事项
如果仓库是公开的,那么上述配置则不需要修改,因为公开的仓库,在pull的时候,不需要账户和密码.
如果仓库是私有的,那么还需要做一下配置:
Windows配置:
1 进入 C:\Documents and Settings\xxx.,找到.git-credentials文件,
touch .git-credentials
2 用记事本修改.git-credentials.格式如下:
https://{ username }:{ password }@ xxx .com
eg:https://zhangsan:123456@gitee.com
3 在任意目录 打开git-bash,输入:
git config –global credential.helper store
4 执行完后去查看 C:\Documents and Settings\Administrator.gitconfig 这个文件,发现多了一项:
[credential] helper = store
5 重新使用git pull.此时便不再需要输入密码.
Linux配置:
1 进入 /home/chinaestone(有些在root下面),找到.git-credentials文件,
2 输入内容如下:
https://{username}:{password}@github.com
eg:https://zhangsan:123456@gitee.com
3 保存文件退出后,输入以下指令:
git config –global credential.helper store
4 此时在/home/chinaestone/.gitconfig 会新增一项
helper = store
5 重新使用git pull.此时便不再需要输入密码.
第一步 配置WebHooks
在[码云](https://gitee.com/)上,自己的项目中,选择"管理" --> "WebHooks",这个时候你能看到下图界面.
注:1 URL填写为自己接收端的地址,配置后,每次代码更新后会通过该地址发送更新的消息.
2 密码:可以不填写.
第二步 服务器脚本配置
在保存好脚本文件后,注意一下事项:
1 该脚本必须在PHP环境中运行,其他环境根据情况修改.
2 需要将该文件访问地址,替换到第一步的URL中.
3 根据实际情况,修改脚本中的参数:savePath,gitPath,email ,name.
4 isClone 变量,第一次clone的时候,需要设置成false,已经clone过后,需要设置成true.
<?php
//git webhook 自动部署脚本
//项目存放物理路径,第一次clone时,必须保证该目录为空
$savePath = "/www/wwwroot/eia/server/";
$gitPath = "https://gitee.com/jerry_hui/tools.git";//代码仓库
$email = "your email";//用户仓库邮箱
$name = "your name";//仓库用户名,一般和邮箱一致即可
$isClone = false;//设置是否已经Clone到本地,true:已经clone,直接pull,false:先clone.
//如果已经clone过,则直接拉去代码
if ($isClone) {
$requestBody = file_get_contents("php://input");
if (empty($requestBody)) {
die('send fail');
}
//解析Git服务器通知过来的JSON信息
$content = json_decode($requestBody, true);
//若是主分支且提交数大于0
if ($content['ref']=='refs/heads/master' && $content['total_commits_count']>0) {
$res = PHP_EOL."pull start --------".PHP_EOL;
$res .= shell_exec("cd {$savePath} && git pull {$gitPath}");//拉去代码
$res_log = '-------------------------'.PHP_EOL;
$res_log .= $content['user_name'] . ' 在' . date('Y-m-d H:i:s') . '向' . $content['repository']['name'] . '项目的' . $content['ref'] . '分支push了' . $content['total_commits_count'] . '个commit:';
$res_log .= $res.PHP_EOL;
$res_log .= "pull end --------".PHP_EOL;
file_put_contents("git-webhook_log.txt", $res_log, FILE_APPEND);//写入日志到log文件中
}
}else {
$res = "clone start --------".PHP_EOL;
//注:在这里需要设置用户邮箱和用户名,不然后面无法拉去代码
$res .= shell_exec("git config --global user.email {$email}}").PHP_EOL;
$res .= shell_exec("git config --global user.name {$name}}").PHP_EOL;
$res .= shell_exec("git clone {$gitPath} {$savePath}").PHP_EOL;
$res .= "clone end --------".PHP_EOL;
file_put_contents("git-webhook_log.txt", $res, FILE_APPEND);//写入日志到log文件中
}
注意事项
如果仓库是公开的,那么上述配置则不需要修改,因为公开的仓库,在pull的时候,不需要账户和密码.
如果仓库是私有的,那么还需要做一下配置:
Windows配置:
1 进入 C:\Documents and Settings\xxx.,找到.git-credentials文件,
touch .git-credentials
2 用记事本修改.git-credentials.格式如下:
https://{ username }:{ password }@ xxx .com
eg:https://zhangsan:123456@gitee.com
3 在任意目录 打开git-bash,输入:
git config –global credential.helper store
4 执行完后去查看 C:\Documents and Settings\Administrator.gitconfig 这个文件,发现多了一项:
[credential] helper = store
5 重新使用git pull.此时便不再需要输入密码.
Linux配置:
1 进入 /home/chinaestone(有些在root下面),找到.git-credentials文件,
2 输入内容如下:
https://{username}:{password}@github.com
eg:https://zhangsan:123456@gitee.com
3 保存文件退出后,输入以下指令:
git config –global credential.helper store
4 此时在/home/chinaestone/.gitconfig 会新增一项
helper = store
5 重新使用git pull.此时便不再需要输入密码.