Configuración de vagrant / puppet para configuración de vhost compleja (si declaraciones, etc.)?

1

Configuré mi vagrant box a través de un paquete https://puphpet.com/ preconfigurado con PHP 5.4 y Nginx.

Después del aprovisionamiento, siempre tengo que cambiar el vhost_autogen.conf por mí mismo; supongo que esa no puede ser la idea detrás de vagabundo y títere :-) ¿Cómo puedo:

  • elimine el vhost_autogen.conf automáticamente y reemplácelo con otro

O

  • añadir los siguientes ajustes como configuración de marionetas?

Esta es la configuración de vhost requerida:

server {

listen *:80;

server_name example.dev www.example.dev;

root /var/www/example.com;

index index.php;

access_log /var/log/nginx/example.com.de.access.log;

error_log /var/log/nginx/example.com.error.log;

if ($host ~* www.(.*)) { set $host_without_www $1; rewrite ^(.*)$ $scheme://$host_without_www$1 permanent; #1 #rewrite ^ $scheme://$host_without_www$1request_uri permanent; #2 }

# Rewrite for minify rewrite ^/min/([a-z]=.*) /min/index.php?$1 last;

# canonicalize codeigniter url end points

if ($request_uri ~* ^(/start(/index)?|/index(.php)?)/?$) { rewrite ^(.*)$ / permanent; }

# removes trailing "index" from all controllers if ($request_uri ~* index/?$) { rewrite ^/(.*)/index/?$ /$1 permanent; }

# removes trailing slashes (prevents SEO duplicate content issues) if (!-d $request_filename) { rewrite ^/(.+)/$ /$1 permanent; }

# removes access to "system" folder, also allows a "System.php" controller if ($request_uri ~* ^/system) { rewrite ^/(.*)$ /index.php?/$1 last; break; }

# unless the request is for a valid file (image, js, css, etc.), send to bootstrap if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?/$1 last; break; }

# catch all error_page 404 /index.php;

location / { root /var/www/example.com; rewrite ^/min/([a-z]=.*) /min/index.php?$1 last; }

location = /robots.txt { access_log off; log_not_found off; } location = /favicon.ico { access_log off; log_not_found off; } location ~ /. { access_log off; log_not_found off; deny all; } location ~ ~$ { access_log off; log_not_found off; deny all; }

location ~ .php$ { root /var/www/example.com; try_files $uri $uri/ /index.php?$args ; index index.html index.htm index.php; fastcgi_index index.php; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param APP_ENV dev;

   fastcgi_pass unix:/var/run/php5-fpm.sock;
   fastcgi_split_path_info ^(.+\.php)(/.+)$;
   include fastcgi_params;

} }

0

En puppet/manifest.pp, busque create_resources(nginx_vhost, $nginx_values['vhosts']), reemplácelo con lo siguiente:

  file { "/etc/nginx/sites-enabled/my-site.conf":
  source => '/full/path/to/conf/file',
  owner  => 'root',
  group  => 'root',
  mode   => '0644'
  }
0