- 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 NetBeans
- 動手玩轉(zhuǎn)Scratch3.0編程:人工智能科創(chuàng)教育指南
- iOS開發(fā)實戰(zhàn):從零基礎(chǔ)到App Store上架
- 軟件測試工程師面試秘籍
- 程序員考試案例梳理、真題透解與強化訓(xùn)練
- 游戲程序設(shè)計教程
- iOS編程基礎(chǔ):Swift、Xcode和Cocoa入門指南
- 可解釋機器學(xué)習(xí):模型、方法與實踐
- C語言課程設(shè)計
- Learning Concurrent Programming in Scala
- Instant Lucene.NET
- 編寫高質(zhì)量代碼:改善Objective-C程序的61個建議
- Mastering ASP.NET Core 2.0
- Tkinter GUI Programming by Example
- Java算法從菜鳥到達人