官术网_书友最值得收藏!

  • 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.

主站蜘蛛池模板: 郧西县| 司法| 郑州市| 湖口县| 昔阳县| 廉江市| 漾濞| 呈贡县| 磐安县| 毕节市| 沭阳县| 南充市| 淮南市| 饶河县| 蓬溪县| 鄂尔多斯市| 玉屏| 娄底市| 老河口市| 肃宁县| 舞钢市| 尼木县| 淮安市| 鹤峰县| 旺苍县| 百色市| 安国市| 休宁县| 鱼台县| 崇阳县| 于都县| 呼玛县| 灵璧县| 容城县| 乃东县| 商丘市| 通化市| 兴业县| 太仓市| 乌兰浩特市| 涞水县|