a2enmod module؛ولتعطيل وحدة ما، يُستَخدَم الأمر a2dismod module. في الواقع هذه البرامج تُنشِئ فقط (أو تحذف) وصلات رمزية في /etc/apache2/mods-enabled/، تشير إلى الملفات الفعلية (المُخزَّنة في /etc/apache2/mods-available/).
/etc/apache2/ports.conf)، ويخدّم الصفحات من المجلد /var/www/html/ (حسب الإعدادات في /etc/apache2/sites-enabled/000-default.conf).
mod_ssl) required for secure HTTP (HTTPS) out of the box. It just needs to be enabled with a2enmod ssl, then the required directives have to be added to the configuration files. A configuration example is provided in /etc/apache2/sites-available/default-ssl.conf.
SSLCertificateFile /etc/letsencrypt/live/DOMAIN/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/DOMAIN/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/DOMAIN/chain.pem SSLCACertificateFile /etc/ssl/certs/ca-certificates.crt
mod_gnutls, which is shipped with the libapache2-mod-gnutls package and enabled with the a2enmod gnutls command. Unfortunately the version packaged for Debian had serious issues and even security implications and is therefor not part of the Debian Bullseye release.
/etc/apache2/sites-enabled/000-default.conf؛ يستخدم هذا المضيف إذا لم يُعثَر على اسم مضيف يطابق طلب العميل.
/etc/apache2/sites-available/. بالتالي، لإعداد موقع وب للنطاق falcot.org يكفي إنشاء الملف التالي، ثم تفعيل المضيف الظاهري باستخدام a2ensite www.falcot.org.
مثال 11.13. الملف /etc/apache2/sites-available/www.falcot.org.conf
<VirtualHost *:80> ServerName www.falcot.org ServerAlias falcot.org DocumentRoot /srv/www/www.falcot.org </VirtualHost>
CustomLog في تعاريف المضيفات الظاهرية). من المنطقي إذن تعديل صيغة ملف السجلات هذا بحيث يتضمن اسم المضيف الظاهري. يمكن تحقيق هذا عبر إنشاء ملف /etc/apache2/conf-available/customlog.conf يُعرِّف صيغة جديدة لكافة ملفات السجلات (باستخدام التعليمة التوجيهية LogFormat) وتفعيله بالأمر a2enconf customlog. كما يجب أيضاً إزالة (أو تعليق) سطر CustomLog من الملف /etc/apache2/sites-available/000-default.conf.
Directory عادة؛ تسمح بتحديد تصرفات المخدم المختلفة حسب موقع الملف الذي يقدمه. هذه الكتل تحوي عادة تعليمتي Options و AllowOverride.
مثال 11.15. كتلة Directory
<Directory /srv/www> Options Includes FollowSymlinks AllowOverride All DirectoryIndex index.php index.html index.htm </Directory>
DirectoryIndex قائمة الملفات لتجربتها عند الرد على العميل عندما يطلب مجلداً. يستخدم أول ملف متوفر ويرسل كرد على الطلب.
Options بقائمة من الخيارات المطلوب تفعيلها. تُعطّل القيمة None جميع الخيارات؛ وفي المقابل، تُفعِّلها All جميعاً عدا MultiViews. من الخيارات المتاحة:
ExecCGI indicates that CGI scripts can be executed.
FollowSymlinks tells the server that symbolic links can be followed, and that the response should contain the contents of the target of such links.
SymlinksIfOwnerMatch also tells the server to follow symbolic links, but only when the link and its target have the same owner.
Includes enables Server Side Includes (SSI for short). These are directives embedded in HTML pages and executed on the fly for each request.
IncludesNOEXEC allows Server Side Includes (SSI) but disables the exec command and limits the include directive to text/markup files.
Indexes tells the server to list the contents of a directory if the HTTP request sent by the client points at a directory without an index file (i.e., when no files mentioned by the DirectoryIndex directive exists in this directory).
MultiViews enables content negotiation; this can be used by the server to return a web page matching the preferred language as configured in the browser.
AllowOverride جميع الخيارات التي يمكن تفعيلها أو تعطيلها باستخدام ملفات .htaccess. أحد الاستخدامات الشائعة لها هو تقييد ExecCGI، بحيث يختار مدير النظام المستخدمين الذين يحق لهم تشغيل البرامج تحت هوية مخدم الوب (المستخدم www-data).
mod_auth* modules.
/etc/apache2/authfiles/htpasswd-private file contains a list of users and passwords; it is commonly manipulated with the htpasswd command. For example, the following command is used to add a user or change their password:
#htpasswd /etc/apache2/authfiles/htpasswd-private userNew password: Re-type new password: Adding password for user user
Require directive controls access restrictions for a directory (and its subdirectories, recursively).
Require معاً ضمن كتلة RequireAll.
/etc/awstats/awstats.conf. لقد ترك مديرو النظم في فلكوت الملف دون تعديل عدا البارمترات التالية:
LogFile="/var/log/apache2/access.log" LogFormat = "%virtualname %host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot" SiteDomain="www.falcot.com" HostAliases="falcot.com REGEX[^.*\.falcot\.com$]" DNSLookup=1 LoadPlugin="tooltips"
LogFile وLogFormat موقع ملف السجلات وصيغة المعلومات التي يحويها؛ ويسرد SiteDomain وHostAliases الأسماء المتنوعة التي يعرف بها الموقع الرئيسي.
1 للمتغير DNSLookup في المواقع عالية الطلب؛ أما بالنسبة للمواقع الأصغر، مثل موقع فلكوت المعروض أعلاه، فيسمح هذا الخيار بالحصول على تقارير أوضح تتضمن الأسماء الكاملة للأجهزة بدلاً من عناوين IP.
/etc/awstats/awstats.www.falcot.org.conf.
مثال 11.18. ملف إعداد AWstats لمضيف ظاهري
Include "/etc/awstats/awstats.conf" SiteDomain="www.falcot.org" HostAliases="falcot.org"
/usr/share/awstats/icon/ directory. In order for these icons to be available on the web site, the Apache configuration needs to be adapted to include the following directive (check out /usr/share/doc/awstats/examples/apache.conf for a more detailed example):
Alias /awstats-icon/ /usr/share/awstats/icon/