如何在本地Google App Engine上运行Wordpress博客 [英] How to Run Wordpress Blog on Google App Engine Locally

查看:112
本文介绍了如何在本地Google App Engine上运行Wordpress博客的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照 GAE教程上的Wordpress ,我已经成功地将博客成功部署到App Engine.

Following the Wordpress on GAE tutorial, I have managed to successfully deploy my blog to App Engine.

但是,我希望在继续开发博客时能够在本地运行我的博客,以便可以检查错误日志等.使用

However, I would like to be able to run my blog locally as I continue its development, so that I can inspect error logs, etc. Using the GAE dev server, I try to run it like so:

dev_appserver.py --log_level=debug app.yaml --php_executable_path=/usr/local/bin/php

但是我遇到了这个问题:

But I run into this problem:

The url "/" does not match any handlers.

我没有更改我的app.yaml或任何其他文件(该文件由本教程中的wp-gae.php步骤自动创建).看起来像这样:

I have not changed my app.yaml nor any other file (the ones auto-created by the wp-gae.php step in the tutorial). It looks like this:

# App Engine runtime configuration
runtime: php72

# Defaults to "serve index.php" and "serve public/index.php". Can be used to
# serve a custom PHP front controller (e.g. "serve backend/index.php") or to
# run a long-running PHP script as a worker process (e.g. "php worker.php").
entrypoint: serve gae-app.php

service: test-wp

# Defines static handlers to serve WordPress assets
handlers:
- url: /(.*\.(htm|html|css|js))
  static_files: \1
  upload: .*\.(htm|html|css|js)$

- url: /wp-content/(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
  static_files: wp-content/\1
  upload: wp-content/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$

- url: /(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
  static_files: \1
  upload: .*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$

- url: /wp-includes/images/media/(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
  static_files: wp-includes/images/media/\1
  upload: wp-includes/images/media/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$

关于我该如何做的任何想法:

Any ideas on how I can:

  1. 解决上面的URL错误?
  2. 是否启用调试日志以显示在我的控制台上?我刚得到INFO 2019-05-29 10:58:02,913 module.py:861] test-wp: "GET / HTTP/1.1" 404 -我已经尝试过在这里建议syslog(LOG_DEBUG,'test')打印语句均未按预期运行.在我的wp-config.php上,我有:define('WP_DEBUG', !$onGae);
  1. fix the URL error above?
  2. enable debug logs to show up on my console? I just get INFO 2019-05-29 10:58:02,913 module.py:861] test-wp: "GET / HTTP/1.1" 404 - I've tried both the flags --log_level=debug and --dev_appserver_log_level=debug as suggested here and echo nor syslog(LOG_DEBUG,'test') print statements are not working as expected. On my wp-config.php, I have: define('WP_DEBUG', !$onGae);

推荐答案

我不知道如何使它起作用.与日志记录响应无关,我遇到了以下帖子: https://introvertedengineer.com/2017/02/20/appengine-and-wordpress-guide/

I took couldn't figure out how to get this to work. Unrelated to the logging response, I came across this post: https://introvertedengineer.com/2017/02/20/appengine-and-wordpress-guide/

其中阐明了使用GAE可能不是最好的方法:

Which spelled out how the using GAE might not be the best approach:

与App Engine打交道时,房间里的大大象是 应用程序无权访问文件系统.这是什么 意思是?嗯,您无法自动更新WordPress,无法安装插件, 您将无法安装主题等.如果您习惯了 通过WordPress管理员进行这些操作,您会很失望的. 像所有事物一样,有一种解决方法!

The big elephant in the room when dealing with App Engine is that your application does not have access to a file system. What does this mean? Well, you can’t autoupdate WordPress, you can’t install plugins, you can’t install themes, etc. If you’re used to being able to do these things via the WordPress admin, you’re going to be disappointed. Like all things, however, there is a workaround!

我首先尝试仅运行本地Google App Engine SDK, 这样启动我的App Engine应用程序.事实证明, 在本地您仍然没有文件系统访问权限,是的,即使在 本地主机!因此,您需要运行本地FTP服务器,然后执行以下操作 WordPress通过FTP而不是直接在文件系统上进行更改. 完成本地更改后,您可以使用Google的SDK来 在生产实例上部署新版本的应用程序.

I first attempted to just run the local Google App Engine SDK and start up my App Engine application that way. Turns out, however, that locally you still don’t have file system access—yeah, even on localhost! So you’ll need to run a local FTP server and then have WordPress make changes via FTP instead of directly on the filesystem. When you’re done with your local changes, you can use Google’s SDK to deploy a new version of your app up to your production instance.

自从GAE现在支持PHP 7以来,本文的编写有点过时了,但是文件系统方面似乎仍然是正确的(希望证明事实是错误的).

The write up is a little outdated since GAE now supports PHP 7, but the file system aspect still seems to be true (would love to be proven wrong).

我最终使用MAMP在本地运行wordpress( https://www.mamp.info/en/),这是一个额外的解决方法,但可以解决该问题.

I ultimately used MAMP to run wordpress locally (https://www.mamp.info/en/), which was an extra workaround, but got through it.

这篇关于如何在本地Google App Engine上运行Wordpress博客的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆