在這裡我已經寫完了專案的基本的文件,你只需要把這個專案複製到你的vue專案中即可!
專案位址docker vue專案
git clone https://github.com/devdocker/dao-vue
cp -r dao-vue vueitem
vueitem 是你的vue项目地址
如果你不了解daocloud.io ,沒關係,去註冊,看文檔,今後會寫關於daocloud.io詳細文檔。
如果你用過daocloud ,請去建立一個項目,編譯發布,設定觸發條件,自動化發佈到你的主機。
當然部署到你的伺服器後,把連接埠寫死,不要動態的。
配置如下##
upstream webfenxi {
server 127.0.0.1:8083; # 这是服务器使用docker启动的端口
}
server
{
listen 80;
#listen [::]:80;
server_name webfenxi.com ; # 这是绑定的自己的域名
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/webfenxi.com;
include other.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location / {
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Nginx-Proxy true;
proxy_pass http://webfenxi; # 代理地址
proxy_redirect off;
# try_files $uri $uri/ /index.html;
}
location /v1/ {
proxy_pass http://api.xxxx.com/v1/; #代理的接口,解决跨域问题
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/webfenxi.com.log;
}
以上是使用docker基於daocloud自動化部署到自己的主機的詳細內容。更多資訊請關注PHP中文網其他相關文章!