Home > Web Front-end > JS Tutorial > Use docker to automatically deploy to your own host based on daocloud

Use docker to automatically deploy to your own host based on daocloud

小云云
Release: 2018-01-03 15:01:55
Original
1895 people have browsed it

In front-end development, deploying projects is something that often happens to us. This article mainly talks about how to deploy vue projects elegantly, using docker containers and git webhook hooks. When we trigger the git hook event, we will deploy automatically. . Of course the suggestion here is the tag event.

Here I have finished writing the basic files of the project, you only need to copy this project to your vue project!

Project address docker vue project

Instructions for use

<span style="font-size: 16px;">git clone https://github.com/devdocker/dao-vue<br><br>cp -r dao-vue vueitem<br><br>vueitem 是你的vue项目地址<br></span>
Copy after login

At this time your project file structure

Use docker to automatically deploy to your own host based on daocloud

##Then go to the daocloud.io official website to create a new project based on this project

If you don’t know daocloud.io, it doesn’t matter, just register and read the documentation. I will write detailed documentation about daocloud.io in the future.

If you have used daocloud, please create a project, compile and publish, set trigger conditions, and automatically publish to your host. Of course, after deploying it to your server, write down the port and don’t make it dynamic.

Then you can use nginx upstream proxy_pass reverse proxy to solve cross-domain problems

The configuration is as follows

<span style="font-size: 16px;">upstream webfenxi {<br>        server 127.0.0.1:8083; # 这是服务器使用docker启动的端口<br>}<br>server<br>    {<br>        listen 80;<br>        #listen [::]:80;<br>        server_name webfenxi.com ; # 这是绑定的自己的域名<br>        index index.html index.htm index.php default.html default.htm default.php;<br>        root  /home/wwwroot/webfenxi.com;<br><br>        include other.conf;<br>        #error_page   404   /404.html;<br><br>        # Deny access to PHP files in specific directory<br>        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }<br><br>        include enable-php.conf;<br><br>        location / {<br>                proxy_set_header X-Real-Ip $remote_addr;<br>                proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;<br><br>                proxy_set_header X-Nginx-Proxy true;<br>                proxy_pass http://webfenxi;  # 代理地址<br>                proxy_redirect off;<br>               # try_files $uri $uri/ /index.html;<br>             }<br><br>          location /v1/ {<br>             proxy_pass http://api.xxxx.com/v1/;  #代理的接口,解决跨域问题<br>          }<br><br>          location ~ /.well-known {<br>              allow all;<br>          }<br><br>          location ~ /\.<br>          {<br>              deny all;<br>          }<br><br>          access_log  /home/wwwlogs/webfenxi.com.log;<br>      }<br></span>
Copy after login
Related recommendations:

How to use Docker to deploy a PHP development environment

How to use Docker to build a Laravel environment

##docker Simple example of installing mysql

The above is the detailed content of Use docker to automatically deploy to your own host based on daocloud. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template