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

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.

主站蜘蛛池模板: 彭泽县| 卓尼县| 镇赉县| 江口县| 申扎县| 汕尾市| 莫力| 禹城市| 南宫市| 青铜峡市| 中江县| 富裕县| 清新县| 宜君县| 合肥市| 新疆| 岳池县| 伽师县| 铁力市| 浦城县| 巴中市| 湘潭县| 个旧市| 博乐市| 同仁县| 共和县| 台湾省| 胶南市| 大石桥市| 上饶县| 安吉县| 长岛县| 枣阳市| 华容县| 兴化市| 疏附县| 来安县| 封开县| 丰城市| 通州市| 乐东|