Install WordPress Multisite on Debian8 Nginx

Warning: Draft Only, still work on this !!!

Parent Document:
Complete Walkthrough to Create a WordPress Production Platform –


  • Debian 8 LEMP

Following steps:

  1. Configure Nginx configuration for wordpress
  2. Download wordpress, move it to /var/www
    Let the wordpress root folder out of /var/www/html/, it is save not to rename the wordpress folder (/var/www/wordpress).We will have 2 root folder:
    /var/www/html/ for HTTP (we will disable this after the platform is running well)
    /var/www/wordpress/ for WordPress HTTPS

    cd ~
    wget -c
    tar -zxvf latest.tar.gz
    sudo mv ~/wordpress /var/www
  3. Create nginx.conf file on wordpress
    touch /var/www/wordpress/nginx.conf
  4. Set nginx daemon ownership (usually: www-data) on wordpress folder
    ps -ef | grep nginx

    First word in line with nginx worker process is the name of nginx daemon user.
    Set wordpress folder ownership to nginx daemon user

    sudo chown -R www-data:www-data /var/www/wordpress
  5. Create WordPress database, use your own unique name, avoid wordpress to protect from zero day attack, for example: notwordpress, create a unique secure and complicated password that other admin will be able to see (will be written in plain text on wp-config.php) MyNotSoSecretWordpressDBKeyWrite down the username and password on your admin book.
    Make sure there are no database and user already named notwordpress in your database, or it will be removed by following SQL script:

    mysql -u root -p
     show databases; // make sure no such database name
     create database notwordpress;
     select user,host from mysql.user; // make sure no such user name
     create user notwordpress; 
     set password for notwordpress = password("MyNotSoSecretWordpressDBKey");
     show grants for "notwordpress";
     revoke all privileges, grant usage from "notwordpress"@"localhost";
     use database notwordpress;
     grant all privileges on notwordpress.* to "notwordpress"@"localhost" identified by "MyNotSoSecretWordpressDBKey"; 
     flush privileges; 
     show grants for "notwordpress";
     show grants for "notwordpress"@"localhost";
  6. Register your domain if you haven’t done so, let say
    Server domain will be the root of your multisite wordpress. Sometime its difficult to copy or migrate root of multisite wordpress, so don’t plan to use it for a frequently moved site.On your DNS server,
    Create ANAME record to your server IP
    Create CNAME record www to @
  7. Configure your registered domain on nginx
    sudo nano /etc/nginx/sites-available/myserverdomain.conf
    map $http_host $blogid {
       default 0; 1;
    server {
       root /var/www/wordpress;
       access_log /var/log/nginx/;
       error_log /var/log/nginx/;
       include /var/www/wordpress/nginx.conf;

    [Control-x], [y], [Enter] to save and exit nano.

    Create symlink to enable the available domain:

    cd /etc/nginx/sites-enabled
    ln -s /etc/nginx/sites-available/myserverdomain.conf
  8. Run wordpress web installer:Check nginx configuration and restart the server
    sudo chmod -R 755 /var/www/wordpress
    sudo chown -R www-data:www-data /var/www/wordpress
    sudo nginx -t
    sudo service nginx restart

    Browse to, WordPress installation helper script will start.

    Follow the installation instruction
    – Choose language English (you may change that later)
    – Click [Lets go!]
    – Enter database name: notwordpress
    – Enter database user name: notwordpress
    – Enter database password: MyNotSoSecretWordpressDBKey
    – Enter prefix: wp_ (change prefix if not the first wordpress installation)
    – Click [Run the install]

    – Enter root site title: yoursitetitle
    – Enter WP first user email:
    – Enter WP first user password: yourwppassword


  9. Check the WordPress installationBrowse to
    Login using your wp email and password.
  10. Activate Multisite on wp-config.php
    sudo nano /var/www/wordpress/wp-config.php

    add before: /* That’s all, stop editing! Happy blogging. */

    define('WP_ALLOW_MULTISITE', true);

    [Control-x], [y], [Enter] to save and exit nano.

    Refresh browser, check that there is a new admin menu: Tools – Network Setup

  11. Set the multisite options for wp-configMultisite – Network SetupDashboard – Tools – Network Setup
    Warning: you cannot change this later
    Choose: Sub-domains (make sure you have wildcard DNS record) – [Install].
    Result will shown some instruction for wp-config.php and for .htaccess.
    Keep the network setup browser open.Copy text for wp-config.php from the browser, then go to Bitvise Xterm SSH console.

    sudo nano /var/www/wordpress/wp-config.php

    Put the cursor one line before:

    /* That's all, stop editing! Happy blogging. */

    and one line after:

    define('WP_ALLOW_MULTISITE', true);

    Left click to paste the copied text.
    [Control-x], [y], [Enter] to save and exit nano.

    Copy text for .htaccess from the browser, then go to Bitvise Xterm SSH console.
    No need to do this for Nginx only server.

    sudo nano /var/www/wordpress/.htaccess

    left click to paste the copied text.
    [Control-x], [y], [Enter] to save and exit nano.

    Logout WP-Admin and re-login.
    Check that there is a new My Sites menu on top left of the Dashboard.

  12. Install WP Multi Domain Plugins
    [Network Admin] – [Plugins] – [Add New]

      cp /var/www/wordpress/wp-content/plugins/wordpress-mu-domain-mapping/sunrise.php /var/www/wordpress/wp-content/
      sudo nano /var/www/wordpress/wp-config.php
      define('SUNRISE', 'on');

    [Control-x], [y], [Enter] to save and exit nano.

    Check following, uncheck other options:
    Permanent redirect (better for your blogger’s pagerank)
    User domain mapping page

  13. Create MU helper plugins to show column IDFrom here:

    sudo nano /var/www/wordpress/wp-content/mu-plugins/wpms_blogid.php

    add_filter( 'wpmu_blogs_columns', 'do_get_id' );
    add_action( 'manage_sites_custom_column', 'do_add_columns', 10, 2 );
    add_action( 'manage_blogs_custom_column', 'do_add_columns', 10, 2 );
    function do_add_columns( $column_name, $blog_id ) {
     if ( 'blog_id' === $column_name )
     echo $blog_id;
     return $column_name;
    function do_get_id( $columns ) {
     $columns['blog_id'] = 'ID';
     return $columns;
  14. Add New Domain


Related walk-through:

Reinstalling Multisite WordPress


One thought on “Install WordPress Multisite on Debian8 Nginx”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s