GT 前端部署

From GoToken's Wiki!
Jump to navigation Jump to search


nginx[edit] sudo apt update sudo apt install nginx 有可能需要执行 sudo apt-get update sudo apt-get install nginx

nodejs & npm[edit] sudo apt update sudo apt install nodejs sudo apt install npm 执行完 Installing Using a PPA node --version, 确保在 v10 再根据提示安装 yarn


在 leec 用户下[edit]

第一次进入 mkdir code cd ~/code git clone [email protected]:gotoken-io/gt-frontend.git cd ~/code/gt-frontend yarn


[每次pull 新代码后都执行一下操作] yarn yarn run build

查看当前ip curl -4

nginx 配置[edit]

服务器需要先对外开放 80 端口

   server {
   listen 80;
   # gzip config
   gzip on;
   gzip_min_length 1k;
   gzip_comp_level 9;
   gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
   gzip_vary on;
   gzip_disable "MSIE [1-6]\.";
   # root /usr/share/nginx/html;
   location / {
       # 用于配合 browserHistory使用
       try_files $uri $uri/ /index.html;
       alias /home/leec/code/gt-frontend/dist/;
   location /server {
       proxy_set_header   X-Forwarded-Proto $scheme;
       proxy_set_header   X-Real-IP         $remote_addr;
   nginx -t

nginx 相关命令[edit]

sudo systemctl start nginx sudo systemctl restart nginx