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

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.

主站蜘蛛池模板: 吉安县| 北海市| 广宗县| 平泉县| 武冈市| 云霄县| 旅游| 安龙县| 揭西县| 陇南市| 紫阳县| 隆安县| 濮阳市| 芜湖市| 济源市| 南投市| 三门峡市| 封丘县| 彰化市| 鄂州市| 礼泉县| 察隅县| 读书| 兴国县| 获嘉县| 万源市| 保定市| 宁乡县| 井研县| 西和县| 萨迦县| 阿巴嘎旗| 延安市| 万荣县| 枣庄市| 全南县| 孝感市| 明水县| 红河县| 炎陵县| 吉首市|