gpt4 book ai didi

php - 带有 Vagrant 的 LEMP 堆栈 - 无法安装 Php5-fpm/Nginx?

转载 作者:行者123 更新时间:2023-12-04 18:32:18 26 4
gpt4 key购买 nike

我对 Vagrant 很陌生,但我正在尝试基于 this 进行 Vagrant 设置使用 Puppet,但基于 Linux 14.04 而不是 12.04。但是,将 VM 更改为“ubuntu/trusty64”会导致安装失败。
据我所知,它在某处安装 Nginx 或 PHP5-fpm 失败。

运行 vagrant up 后收到以下错误消息,当我去本地服务器时,我得到一个“欢迎使用 Nginx!”页:

(让我知道我是否应该发布整个内容,这只是我可以在终端中看到的错误消息)

==> default: Error: /Stage[main]/Php5-fpm/File[/etc/php5/fpm/php.ini]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///php5-fpm/php.ini
==> default: Error: /Stage[main]/Php5-fpm/File[/etc/php5/fpm/pool.d/www.conf]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///php5-fpm/www.conf

...
==> default: Notice: /Stage[main]/Wordpress::Setup_db/Exec[create-user]/returns: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* to @localhost identified by ""' at line 1
==> default: Error: mysql -uroot -pvagrant --execute 'grant all on .* to @localhost identified by ""' returned 1 instead of one of [0]
==> default: Error: /Stage[main]/Wordpress::Setup_db/Exec[create-user]/returns: change from notrun to 0 failed: mysql -uroot -pvagrant --execute 'grant all on .* to @localhost identified by ""' returned 1 instead of one of [0]

(我确实尝试更正这里的语法,摆脱错误,但这并没有影响更大的问题)

...
==> default: Error: /Stage[main]/Nginx/File[/etc/nginx/nginx.conf]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///nginx/nginx.conf

...
==> default: Notice: /Stage[main]/Nginx/Service[nginx]: Dependency File[/etc/nginx/nginx.conf] has failures: true
==> default: Warning: /Stage[main]/Nginx/Service[nginx]: Skipping because of failed dependencies

...
==> default: Notice: /Stage[main]/Php5-fpm/Service[php5-fpm]: Dependency File[/etc/php5/fpm/pool.d/www.conf] has failures: true
==> default: Notice: /Stage[main]/Php5-fpm/Service[php5-fpm]: Dependency File[/etc/php5/fpm/php.ini] has failures: true
==> default: Warning: /Stage[main]/Php5-fpm/Service[php5-fpm]: Skipping because of failed dependencies

...
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

知道为什么这适用于 hashcorp/precise64 盒子,但不适用于 ubuntu/trusty64?
我猜它是在 php/nginx 的设置中,但我不知道为什么。我的文件与 this 中的完全相同设置。

谢谢!

最佳答案

核心问题是 Puppet 版本的差异。

Ubuntu 12.04 LTS Precise(Vagrant box 'hashicorp/precise64'):

root@lemp:~# puppet --version
2.7.19
root@lemp:~#

Ubuntu 14.04 LTS Trusty(Vagrant box 'ubuntu/trusty64'):
root@lemp:~# puppet --version
3.4.3
root@lemp:~#

当我在 Precise 上进行配置时,我收到了一些折旧警告:

==> default: warning: Dynamic lookup of $mysql_user at /tmp/vagrant-puppet/modules-7de194db6a79aa7dabd1c451463ec16b/wordpress/manifests/init.pp:22 is deprecated. For more information, see http://docs.puppetlabs.com/guides/scope_and_puppet.html. To see the change in behavior, use the --debug flag.



我已经 fork 了您链接的存储库并提交了非常基本的更改,以解决折旧问题并允许它与 ubuntu/trusty64 vagrant 框一起使用。您可以找到代码 here .

如果您只想查看差异,请查看 this commit .

注意:我在我的 Vagrantfile 中使用了一些 Vagrant 插件,我建议你也使用它们。
  • https://github.com/adrienthebo/vagrant-auto_network
  • https://github.com/adrienthebo/vagrant-hosts

  • 编辑:我也创建了这个 pull request .

    关于php - 带有 Vagrant 的 LEMP 堆栈 - 无法安装 Php5-fpm/Nginx?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28276620/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com