ubuntu安装wikimedia使用nginx/二级域名

  1. 下载mediawiki的安装包

    wget https://releases.wikimedia.org/mediawiki/1.31/mediawiki-1.31.0.tar.gz
    
  2. 解压

    tar -zxvf mediawiki-1.31.0.tar.gz
    
  3. 复制到/var/wiki/html目录

    cp -r /mediawiki-1.31.0/. /var/wiki/html
    
  4. 配置nginx

    server {
        listen 80;
        server_name wiki.yourdomain.com;
        root /var/wiki/html;
        index index.php index.html index.htm;
    
        location / {
            try_files $uri/ /index.php?$args;
        }
        
        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
        }
        location ~* \.(js|css|png|jpg|jpeg|gif|ico|eot|otf|ttf|woff)$ {
            add_header Access-Control-Allow-Origin *;
            add_header Cache-Control "public, max-age=31536000, immutable";
            access_log off; log_not_found off;
        }
        location = /robots.txt { access_log off; log_not_found off; }
        location ~ /\. { deny all; access_log off; log_not_found off; }
    }
    
    /usr/loca/nginx/sbin/nginx -s reload
    
  5. 配置域名解析


    image.png
  1. 访问 wiki.yourdomain.com
    搞定

你可能感兴趣的:(ubuntu安装wikimedia使用nginx/二级域名)