Nginx/MediaWiki

The Web Server sends and receives data over the HTTP protocol. In the case of MediaWiki, the web server serves HTML pages to a user’s web browser. We’ve chosen Nginx instead of Apache for it’s greater effectiveness with serving and caching static HTML.

Installing Nginx
Follow one of these guides to install Nginx for your Linux Distribution.


 * Debian 8: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-debian-8
 * Ubuntu 16.04 LTS: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04
 * RHEL/CentOS 7: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-centos-7

HHVM
If you are using HHVM as your PHP Engine, use these Nginx Configs.

PHP-FPM
If you are using PHP-FPM as your PHP Engine, use these Nginx Configs.

PHP-FPM Nginx Config
To make it easy to switch all our present or future PHP apps between TCP ports and UNIX sockets, we use a specific `php-fpm.conf` file which can be called with. Create this file:

MediaWiki Nginx Config
This is the Nginx Config that we use when when setting up MediaWiki for the first time over conventional HTTP, with PHP-FPM:


 * Path to Mediawiki installation:


 * Source: BigDinosaur Blog: Mediawiki with Nginx

After setting up MediaWiki, make sure to uncomment the  block to allow index.php to be used, and the   line to disable access to the installation directory.

Also consider setting up an SSL certificate with this Nginx config.

Serving MediaWiki images with Nginx
Nginx can be optimized to make image serving more efficient, and block hotlinking. Since the settings for static images often differ greatly from that of dynamic text, it is recommended that you create a specific subdomain just for images (such as ) and serve your image folder from there.

Here is the Nginx config we used (without SSL) to serve our image folder:

After setting this up, just add this line to LocalSettings:

https://serversforhackers.com/nginx-caching