Reputation: 2303
I am using a vagrant/puppet to configure my testmachine, i am using it to configure the virtualhost for apache, but when starting apache i get an error, apparently for weird spacing or characters or so:
/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.
the manifest file that i wrote to configure the virtualhost looks like this
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>",
}
Upvotes: 1
Views: 2899
Reputation: 19870
c2 a0
(in the error message) is the unicode code for the special character "non breaking space", cf. here.
It seems that apache doesn't like that at all. So you must get rid of those non-breaking spaces and use normal ones, even if it looks the same in your editor.
You can use NotePad++ and ask it to convert your puppet files to "ANSI", which is a safer encoding for config files.
You must have cleaned that without knowing it while moving the content to an external file, but using an external file is not the solution, even if it worked.
Upvotes: 3
Reputation: 2303
solved it using this:
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 is in a shared folder (path is on image)
Upvotes: 0