我正在为 Vagrant 设置一个 puppet 文件以用于配置 LEMP 堆栈,到目前为止,我已经能够通过以下方式安装我需要的一切:
exec { "apt-get update":
command => "/usr/bin/apt-get update",
}
package { "acl":
ensure => "present",
require => Exec ["apt-get update"],
}
class nginx{
package { "nginx":
ensure => present,
require => Exec ["apt-get update"],
}
service { "nginx":
ensure => "running",
require => Package["nginx"],
}
file { "/var/www":
ensure => "link",
target => "/vagrant/web",
require => Package["nginx"],
notify => Service["nginx"],
force => true,
}
}
class php {
package { "php5-cli": ensure => present }
package { "php5-dev": ensure => present }
package { "php5-mysql": ensure => present }
package { "php-pear": ensure => present }
package { "php5-common": ensure => present}
package { "php5-fpm": ensure => present}
package { "php5-cgi": ensure => present}
package { "php-apc": ensure => present}
exec { "pear upgrade":
command => "/usr/bin/pear upgrade",
require => Package["php-pear"],
}
}
class mysql {
package { "mysql-server":
require => Exec["apt-get update"],
ensure => present,
}
service { "mysql":
enable => true,
ensure => running,
require => Package["mysql-server"],
}
exec { "Set MySQL server root password":
require => Package["mysql-server"],
unless => "/usr/bin/mysqladmin -uroot -proot status",
command => "/usr/bin/mysqladmin -uroot password root",
}
}
include nginx
include php
include mysql
我已经正确设置了 Vagrant,我为此使用了 LAMP 堆栈脚本,它完美地工作;然而,用 Nginx 代替 Apache 和 php-fpm 代替 php5 导致了中断。每当我尝试加载我的网站时,我都会收到“欢迎使用 nginx!”。如果我指定图像(或任何其他静态文件)的特定路径,则会加载图像。如果我指定 PHP 文件的特定路径,PHP 文件将被下载而不是执行。
我正在使用 Ubuntu 12.04 64 位。
我认为套接字没有从 Nginx 端正确设置,但我不完全确定如何通过 puppet manifests 文件设置它以实现可移植性。
想法?