服务器上部署GIT上线命令
来源:互联网 发布:沈阳seo那家好 编辑:程序博客网 时间:2024/06/02 05:17
服务器上部署GIT上线命令
结构:
服务器+本地环境
1.在服务器git上建立一个裸仓库
# 服务器上$ mkdir project.git$ cd project.git$ git --bare init
2.将你本地的代码上传到服务器
# 在你的电脑上$ cd myproject$ git init$ git add .$ git commit -m 'initial commit'$ git remote add origin git@gitserver:project.git$ git push origin master
3.在服务器的web工作目录下克隆该项目
# 服务器的web工作目录$ git clone git@gitserver:project.git project$ git clone user@IP:repositories/project.git project
4.新建虚拟主机文件
在/usr/local/etc/nginx/site-avaliable目录下复制原配置文件为myproject,修改server_name和root项就可以了。为了便于分析管理,最好也将access_log和error_log项修改为你定义的域名的名字。
server { listen 80; server_name myproject.com; root /var/www/myproject/frontend/web/; index index.php; access_log /usr/local/var/logs/nginx/myproject.access.log main; error_log /usr/local/var/logs/nginx/myproject.error.log; location / { index index.html index.htm index.php; autoindex on; include /usr/local/etc/nginx/conf.d/php-fpm; try_files $uri $uri/ /index.php?$args; } location = /info { allow 127.0.0.1; deny all; rewrite (.*) /.info.php; } #error_page 404 /404.html; #error_page 403 /403.html;}
5.建立软连接到/usr/local/etc/nginx/site-enabled/myproject
ln -s /usr/local/etc/nginx/site-avaliable/myproject /usr/local/etc/nginx/site-enabled/myproject
6.如果你是在本地测试,需要修改/etc/hosts文件
### Host Database## localhost is used to configure the loopback interface# when the system is booting. Do not change this entry.##127.0.0.1 localhost255.255.255.255 broadcasthost::1 localhost127.0.0.1 myprooject.com
7.如果你的代码已经部署到线上,而你在域名映射方面有点问题,你又想测试你线上的代码是否有问题。你可以在线上配置好虚拟域名,然后在你本地hosts上做映射来测试。就在本地实现了通过域名访问线上代码。
### Host Database## localhost is used to configure the loopback interface# when the system is booting. Do not change this entry.##127.0.0.1 localhost255.255.255.255 broadcasthost::1 localhost192.110.110.110 myprooject.com #192.110.110.110是指你线上的IP,这里只是举一个例子,无实际意义。
0 0
- 服务器上部署GIT上线命令
- 在服务器上部署Git
- 服务器上的 Git - 在服务器上部署 Git
- 4.2 服务器上的 Git - 在服务器上部署 Git
- Linux服务器部署上线步骤
- web项目部署服务器上线
- (原创)Centos6.4上用gitolite部署git服务器
- 使用gitblit在windows上部署git服务器
- 用 GIT 把代码部署到服务器上
- 使用gitblit在windows上部署git服务器
- WEB项目如何部署到服务器上线
- 如何使用git命令将项目部署到GitHub上
- Ubuntu 部署git服务器
- 部署GIT 服务器仓库
- Git 服务器部署
- CentOS 部署git服务器
- java工程在linux服务器上部署需要的命令
- Git命令提交代码到Gitblit本地服务器上
- coredata理解
- 数据库的三范式及mysql的InnoDB 和MyISAM区别
- Java非对称加密算法--RSA加密算法 原文http://blog.csdn.net/qiuzhping/article/details/44344373
- JAVA 开发平台的技术和框架(二)前端控制器:Struts2 ,Spring MVC
- Oculus Rift DK2 驱动安装教程
- 服务器上部署GIT上线命令
- 【LeetCode】Swap Nodes in Pairs 链表指针的应用
- POJ2586 Y2K Accounting Bug 贪心
- JAVA实现RSA加密解密
- 敏捷开发之Scrum扫盲篇
- 手把手教你捕获数据包
- C++ 函数中如何接收数量不定的函数参数
- php 操作数组 (合并,拆分,追加,查找,删除等)
- Aws BMP 两个环境之间的迁移步骤