准备工作
阿里云配置 域名 (*和@)
1.域名的解析,服务器service配置
/usr/local/nginx/conf/vhost melo.conf
server {
listen 80;
#listen [::]:80 default_server ipv6only=on;
#这里需要配置
server_name melo.wangjingye.top;
index index.html index.htm index.php;
#这里需要配置
root /melo/product/firstgit;
#error_page 404 /404.html;
include enable-php.conf;
location /nginx_status {
stub_status on;
access_log off;
}
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php last;
break;
}
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 12h;
}
location ~ /\. {
deny all;
}
}
2.配置数据库的域名
/usr/local/nginx/conf / vi nginx.conf
server
{
listen 80 default_server;
#listen [::]:80 default_server ipv6only=on;
//这里把数据库默认IP地址修改 为其他域名
server_name manage.wangjingye.top;
index index.html index.htm index.php;
root /home/wwwroot/default;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
3.ftp或者git的配置 https://www.cnblogs.com/cidgur/p/8028932.html https://www.cnblogs.com/HuSay/p/9101130.html
git仓库配置
git仓库配置完成后需要配置git仓库/执行工作区的读写权限,否则也是无法执行的
4. 创建文件pushcode.sh 在master目录同级
内容 :
#!/bin/bash
rsync -auv --delete-after (a) master/rizhi/* (b) master_online;
注释:讲路径a的内容 同步到b 此文件经过 ./pushcode.sh 后自动同步 , ./pushcode.sh要在当前文件所在目录执行 ,别忘了检查 文件夹执行/读写权限
5.钩子
#!/bin/bash
#An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
read z j fm
branch=${fm:11}
cd /melo/web/firstweb
rm -rf $branch
mkdir $branch
cd $branch
git clone -b $branch /melo/storage/firstgit.git
~
新钩子 使用git内置命令 效率更高
#! /bin/sh
GIT_WORK_TREE=test_work git checkout -f
sudo chmod -R 777 test_work
web/firstweb/master/firstgit/shop/public
}