- NGINX Cookbook
- Tim Butler
- 127字
- 2021-07-03 00:04:25
How to do it...
The basic NGINX configuration for MediaWiki is very similar to many other PHP platforms. It has a flat directory structure which easily runs with basic system resources.
Here's the configuration:
server { listen 80; server_name mediawiki.nginxcookbook.com; access_log /var/log/nginx/mediawiki.access.log combined; index index.php; root /var/www/html/; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass unix:/var/run/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name; include fastcgi_params; } }
The default installation doesn't use any rewrite rules, which means you'll get URLs such as index.php?title=Main_Page instead of the neater (and more readable) /wiki/Main_Page. To enable this, we need to edit the LocalSettings.php file and add the following lines:
$wgArticlePath = "/wiki/$1"; $wgUsePathInfo = TRUE;
This allows the URLs to be rewritten in a much neater format.
推薦閱讀
- Mastering PHP Design Patterns
- C語言程序設計
- Practical Windows Forensics
- 深入淺出Android Jetpack
- MATLAB 2020從入門到精通
- Python機器學習算法: 原理、實現與案例
- Modernizing Legacy Applications in PHP
- 零基礎學Java第2版
- Sitecore Cookbook for Developers
- Go Systems Programming
- JavaWeb從入門到精通(視頻實戰版)
- Processing開發實戰
- 基于JavaScript的WebGIS開發
- Web前端開發精品課:HTML5 Canvas開發詳解
- HTML 5與CSS 3權威指南(第4版·上冊)