Puppet / Vagrant: APACE Corroged VirtualHost Contenido
Pregunta
Estoy usando un vagante / títere Para configurar mi Testmachine, lo estoy usando para configurar el VirtualHost para Apache, pero al iniciar Apache obtengo un error, aparentemente para espacios o caracteres extraños:
/apache2 start
* Starting web server apache2
Syntax error on line 4 of /etc/apache2/sites-enabled/my-ssl.localhost.conf:
Invalid command '\xc2\xa0\xc2\xa0ServerName', perhaps misspelled or defined by a module not included in the server configuration
Action 'start' failed.
El archivo manifiesto que escribí para configurar el VirtualHost se ve así
file {'hostfile4':
path => '/etc/apache2/sites-available/my-ssl.localhost.conf',
ensure => present,
content => "
<VirtualHost *:443>
DocumentRoot '/coding/mysite/htdocs/'
ServerName foa-ssl.localhost
ServerAlias foa-ssl.localhost
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 0
<Directory '/coding/mysite/checkout/htdocs'>
AllowOverride All
Options All -Indexes
Order allow,deny
Allow from all
php_admin_value short_open_tag Off
AddType application/x-httpd-php .css .js
</Directory>
<Directory '/coding/mysite/app_new/htdocs'>
AllowOverride All
Options All -Indexes
Order allow,deny
Allow from all
php_admin_value short_open_tag Off
AddType application/x-httpd-php .css .js
</Directory>
<Directory '/coding/mysite/cgi-bin'>
Options +ExecCGI
</Directory>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
</VirtualHost>",
}
Solución
c2 a0
(en el mensaje de error) es el código Unicode para el carácter especial "Espacio de ruptura", cf. aquí .
Parece que A Apache no le gusta eso en absoluto.Por lo tanto, debe deshacerse de esos espacios que no se rompen y use los normales, incluso si se ve igual en su editor.
Puede usar BlocApad ++ y pedirle que convertirá sus archivos de títeres en "ANSI", que es una codificación más segura para los archivos de configuración.
Debe haber limpiado eso sin saberlo mientras mueve el contenido a un archivo externo, pero usar un archivo externo no es la solución, incluso si funcionó.
Otros consejos
resuelto usando esto:
file { "/etc/apache2/sites-available/my-ssl.localhost.conf":
mode => 440,
owner => root,
group => root,
source => "/coding/puppetstuff/my-ssl.localhost.conf"
}
/coding/puppetstuff/foa-ssl.localhost.conf está en una carpeta compartida (la ruta está en la imagen)