Apache configuration/ru

Apache is probably the webserver used most with MediaWiki.

PHP как модуль Apache
MediaWiki написана для использования в качестве модуля Apache. PHP настроен как модуль, если ваш сайт начинается с URL такого вида: example.com/index.php/Main_Page Вы можете проверить какая конфигурация и версия PHP используется, с помощью просмотра вашей вики Special:Version страницы, или с помощью phpinfo.

RedHat/Fedora-based Linux
Установка PHP: Перезапуск httpd:
 * 1) yum install php php-xml
 * 1) service httpd reload

Debian-based Linux
Установка apache2 php5 модуля: Включение apache2 php5 модуля: Перезапуск Apache:
 * 1) apt-get install apache2 libapache2-mod-php5 php5-cli php-apc php5-mcrypt
 * 1) a2enmod php5
 * 1) service apache2 restart

PHP как CGI
Если PHP работает как CGI, у вас будут "некрасивые" URL-адреса по умолчанию, но вы можете реализовать.

CGIWrap
Если у вас есть свой ​​собственный сервер с работающим Apache и работающим, вы можете установить CGIWrap. Этот инструмент позволяет запускать сервер Apache от имени другого пользователя для CGIs.

Таким образом, Вы можете создать нового пользователя для страниц МедиаВики. Установка CGIWrap выходит за рамки этого документа, тем более, что Вы должны скомпилировать его на собственном сервере. Однако, в качестве краткого руководства, Вы можете следовать следующим правилам:

useradd -M -s /sbin/nologin wikiuser
 * Создайте Wikimedia пользователя
 * Have a cgi-bin folder, containing CGIWrap (example in /home/myuser/cgi-bin). Once everything is configured, keep only cgiwrap, move the debug versions to another folder if you ever need it. Your cgiwrap file should be accessible only to Apache (chown and chmod accordingly).

ln -s /home/myuser/public_html/wiki /home/myuser/cgi-bin/wikilink AddHandler php-wrapper .php Action php-wrapper /cgi-bin/cgiwrap/wikiuser/wikilink
 * Inside the cgi-bin folder, create a symbolic link to the Wikimedia root.
 * In your wiki's .htaccess file, add the following definitions:
 * Finally, chown and chmod all the .php files of your Wikimedia folder to be accessible solely by wikiuser.

The files will be accessible as usual. You do not need to specify in your path any cgi-bin, as this is transparently taken care for you.

I strongly suggest you start out with /cgi-bin/cgiwrapd/... as your php-wrapper, as it will precisely show what is currently working. I also strongly suggest you do not delete your CGIWrap source folder until everything works perfectly as this is a real trial and error process, taking a long time. However, it's all worth your time as your MediaWiki will be run in its own separate process, in its own uid, without being able to interfere any other uid. Inverse is also true, except for root, that can read anything anywhere.

mod_alias / mod_rewrite
The recommended method of involves mod_alias. Other methods use mod_rewrite instead.

mod_security
has been known to cause problems with MediaWiki. If you get errors seemingly at random, check your error log to see whether it is causing problems.

Размер стека потока (ThreadStackSize)
The stack size for for each Apache thread is configurable and the default varies on different operating systems. To run MediaWiki on Windows environments it may be necessary to increase the stack size (if there are problems), as the 1MB default is small and can cause stack overflows during PHP script execution. The following httpd.conf setting will set the stack size to about 8MB (about a typical Linux default):

Поисковые роботы и боты (robots.txt)
You really should use a file to tell well-behaved spiders not to download dynamically generated pages (edit pages, for instance). This can reduce the load on your webserver, preserve your bandwidth, and prevent duplicate content issues with search engines. However, malicious bots could tie up your webserver and waste your bandwidth by downloading a large volume of pages extremely quickly. Request throttling can help protect against this.