首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使用wordpress开发服务器?

如何使用wordpress开发服务器?
EN

Stack Overflow用户
提问于 2020-03-29 16:25:41
回答 1查看 41关注 0票数 0

我正在测试WordPress for personnal项目,但是我想在本地安装我的开发WordPress网站,并在我的Personnal生产服务器上安装最终网站。

为了做到这一点,我在我的产品wordpress中搜索一个插件或程序,用于将wordpress开发与新页面、模板和配置同步。

有没有程序或插件可以做到这一点?怎样才能更好的使用wordpress呢?

谢谢:)

EN

回答 1

Stack Overflow用户

发布于 2020-03-29 17:21:47

您可以尝试以下两个主题:

-.By计划将文件拷贝到生产环境(如使用crontab的linux CLI )(每分钟):

代码语言:javascript
运行
复制
* * * * * scp local_file remote_username@remote_ip:remote_file

但我不推荐这种方式,为了让你更容易理解。

-.By CICD,这是一个博客链接,如果你不知道这一点,你可以先知道这个概念:

https://thecodingmachine.io/continuous-delivery-on-a-dedicated-server

简而言之,你可以在gitlab或github上将你的项目推送到私有存储库,然后创建开发(=开发服务器),生产(=生产服务器)分支,如果你有git推送,自动化作业将部署到服务器上。

以下是.gitlab-ci.yml文件中链接的主要部分示例:

代码语言:javascript
运行
复制
deploy_staging:
  stage: deploy
  image: kroniak/ssh-client:3.6
  script:
    # add the server as a known host
    - mkdir ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
    - chmod 644 ~/.ssh/known_hosts
    # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$SSH_PRIVATE_KEY")
    # log into Docker registry
    - ssh deployer@thecodingmachine.io "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.thecodingmachine.com"
    # stop container, remove image.
    - ssh deployer@thecodingmachine.io "docker stop thecodingmachine.io_${CI_COMMIT_REF_SLUG}" || true
    - ssh deployer@thecodingmachine.io "docker rm thecodingmachine.io_${CI_COMMIT_REF_SLUG}" || true
    - ssh deployer@thecodingmachine.io "docker rmi registry.thecodingmachine.com/tcm-projects/thecodingmachine.io:${CI_COMMIT_REF_SLUG}" || true
    # start new container
    - ssh deployer@thecodingmachine.io "docker run --name thecodingmachine.io_${CI_COMMIT_REF_SLUG} --network=web -d registry.thecodingmachine.com/tcm-projects/thecodingmachine.io:${CI_COMMIT_REF_SLUG}"
  only:
    - branches
  except:
    - master

你可能很难读懂这篇文章,但你可以知道有一种方法是你需要的,你可能需要花时间来学习这一部分。

希望它能为你工作。

感谢David Négrier的分享。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60911724

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档