سؤال

أنا باستخدام المتشرد / دمية لتكوين بلدي تستماشين ، وأنا استخدامه لتكوين فيرتوالهوست ل أباتشي ، ولكن عند بدء أباتشي أحصل على خطأ ، على ما يبدو لتباعد غريب أو أحرف أو نحو ذلك:

/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.

يبدو ملف البيان الذي كتبته لتكوين المضيف الافتراضي كما يلي

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>",
    }
هل كانت مفيدة؟

المحلول

c2 a0 (في رسالة الخطأ) هو رمز يونيكود للحرف الخاص "عدم كسر الفضاء" ، راجع. هنا.

يبدو أن أباتشي لا يحب ذلك على الإطلاق.لذلك يجب التخلص من تلك المساحات غير كسر واستخدام تلك العادية ، حتى لو كان يبدو نفسه في المحرر الخاص بك.

يمكنك استخدام المفكرة ask واطلب منه تحويل ملفات الدمى الخاصة بك إلى" أنسي " ، وهو ترميز أكثر أمانا لملفات التكوين.

يجب أن تكون قد قمت بتنظيف ذلك دون معرفة ذلك أثناء نقل المحتوى إلى ملف خارجي ، ولكن استخدام ملف خارجي ليس هو الحل ، حتى لو كان يعمل.

نصائح أخرى

حلها باستخدام هذا: giveacodicetagpre.

/coding/puppetstuff/foa-ssl.localhost.conf موجود في مجلد مشترك (مسار على الصورة)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top