FairyLandM's Blog

  • 首页
  • 文章归档
  • 默认分类
  • 关于页面

  • 搜索
linux docker vue vue,lunix,docker

docker部署vue 到linux

发表于 2021-02-19 | 0 | 阅读次数 19

1.安装docker

curl -sSL https://get.daocloud.io/docker | sh

2.将打包了的dist文件夹加入两个文件
Dockerfile 和 default.conf

  1. default.conf

server {
 listen       80;

 #charset koi8-r;
 access_log  /var/log/nginx/host.access.log;

 location / {
   root   /usr/share/nginx/html;
   index  index.html index.htm;
   try_files $uri $uri/ /index.html;   
 }

 #error_page  404              /404.html;

 # redirect server error pages to the static page /50x.html
 #
 error_page   500 502 503 504  /50x.html;
 location = /50x.html {
   root   /usr/share/nginx/html;
 }

 # proxy the PHP scripts to Apache listening on 127.0.0.1:80
 #
 #location ~ \.php$ {
 #    proxy_pass   http://127.0.0.1;
 #}

 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 #
 #location ~ \.php$ {
 #    root           html;
 #    fastcgi_pass   127.0.0.1:9000;
 #    fastcgi_index  index.php;
 #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
 #    include        fastcgi_params;
 #}

 # deny access to .htaccess files, if Apache's document root
 # concurs with nginx's one
 #
 #location ~ /\.ht {
 #    deny  all;
 #}
}
  1. Dockerfile
FROM nginx:1.17
MAINTAINER flowerpig

COPY /  /usr/share/nginx/html/
ADD default.conf /etc/nginx/conf.d/
WORKDIR /usr/share/nginx/html
RUN chmod -R a+rx *

3.securecrt 将文件上传到服务器
使用sftp 进行上传

4.切换到文件夹

docker build -t vue-test .

5.运行

运行容器
docker run --name vue-test -p 8090:80 -d vue-test
  • 本文作者: FairyLandM
  • 本文链接: https://slogc.cc/archives/docker-bu-shu-vuedao-linux
  • 版权声明: 本博客所有文章除特别声明外,均采用CC BY-NC-SA 3.0 许可协议。转载请注明出处!
# linux # docker # vue # vue,lunix,docker
react-native 无法打release包
  • 文章目录
  • 站点概览
FairyLandM

FairyLandM

既然选择了远方,便只顾风雨兼程!

2 日志
3 分类
4 标签
RSS
Creative Commons
© 2021 FairyLandM
由 Halo 强力驱动
|
主题 - NexT.Pisces v5.1.4