Gitlab + Jenkins + Ansible 实现自动部署-小案例

本文档详细介绍了如何通过Gitlab、Jenkins和Ansible实现自动部署的过程,包括在Ubuntu 18.04上安装Nginx、创建GitLab仓库、在Jenkins服务器上初始化项目、配置Jenkins和Gitlab Web钩子,以及在遇到权限问题和Nginx配置不生效等异常时的解决办法。
摘要由CSDN通过智能技术生成

完整版安装过程请参考Gitlab+Jenkins+Ansible安装过程(完整版)on Centos7

在webservers客户机安装nginx (on ubuntu1804)

future@future:~$ apt update
future@future:~$ sudo apt install nginx
future@future:~$ sudo ufw status
Status: inactive
# 如果防火墙已经关闭,则下列操作可以不用
future@future:~$ sudo ufw app list
Available applications:
  Nginx Full
  Nginx HTTP
  Nginx HTTPS
  OpenSSH
future@future:~$ sudo ufw allow 'Nginx HTTP'
# 这条命令选用
future@future:~$ netstat -nplt

future@future:~$ systemctl  status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en
   Active: active (running) since Sun 2020-01-19 15:59:56 UTC; 3min 53s ago
     Docs: man:nginx(8)
  Process: 5747 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code
  Process: 5738 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process
 Main PID: 5748 (nginx)
    Tasks: 7 (limit: 4915)
   CGroup: /system.slice/nginx.service
           ├─5748 nginx: master process /usr/sbin/nginx -g daemon on; master_pro
           ├─5751 nginx: worker process
           ├─5752 nginx: worker process
           ├─5754 nginx: worker process
           ├─5756 nginx: worker process
           ├─5758 nginx: worker process
           └─5759 nginx: worker process
              
    
future@future:~$ sudo vim /etc/nginx/sites-enabled/default
# root /var/www/html;
  root /usr/share/nginx/html;

future@future:~$ sudo sh -c "echo nginx default index file > /usr/share/nginx/html/index.html"
future@future:/etc/nginx/sites-enabled$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值