问题描述
我已经使用Nginx,Php-fpm和Mysql在Google Compute Engine上成功安装了Wordpress.
I've been running a successful Wordpress install on Google Compute Engine with Nginx, Php-fpm and Mysql.
我注意到您还可以通过Cloud SQL连接在App Engine上运行Wordpress,如此处 https://developers.google.com/appengine/articles/wordpress?hl=zh_CN
I noticed you can also run Wordpress on App Engine with a Cloud SQL connection as mentioned here https://developers.google.com/appengine/articles/wordpress?hl=en
我想在Compute Engine上使用Wordpress并在Cloud SQL上运行数据库.
I want to use Wordpress on Compute Engine with the db running on Cloud SQL.
在AppEngine上,您需要在wp-config.php文件中放入以下行
On AppEngine, you need to put the following lines in the wp-config.php file
if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
define('DB_HOST', ':/cloudsql/YOUR_PROJECT_ID:wordpress_db_name');F
}else{
define('DB_HOST', 'localhost');
}
是否有通过Cloud SQL连接Compute Engine上的Wordpress的类似方法?
Is there a similar way to connect Wordpress on Compute Engine with Cloud SQL?
推荐答案
否.无需连接到精美的套接字名称,您需要将Wordpress设置为通常的MySQL客户端,只需记住您需要进行预授权 Compute Engine实例以访问您的Cloud SQL实例.
No. There is no need to connect to fancy socket names, you need to set up Wordpress as a usual MySQL client, just keep in mind that you need to pre-authorize Compute Engine instance to access your Cloud SQL instance.
这篇关于在Google Compute Engine上将Google Cloud SQL与Wordpress连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!