marcc3d
By:
marcc3d

Setup WordPress Multisite Subdirectories Install in a LEMP + ISPConfig3 Stack

January 25, 2017 313 views
WordPress Nginx Ubuntu

Hi there,

I have setup a server following this tutorial
https://www.howtoforge.com/the-perfect-server-ubuntu-14.04-nginx-bind-mysql-php-postfix-dovecot-and-ispconfig3-p6 in a Ubuntu 14.04 droplet. I could install and setup eveything, now I need to make a multisite wordpress install with subdirectories. I have created a new site in the ISPConfig3 and add some settings for nginx following this tutorial
https://www.digitalocean.com/community/tutorials/how-to-configure-single-and-multiple-wordpress-site-settings-with-nginx I have tried everyting I can to make my multisite install works without any success. It seems the server doesn't point to the correct path or something like that, since I even can reach the wordpress installation url. Could someone help me please? Thanks in advance.

1 Answer

@marcc3d

To help troubleshoot, I'd need to see what your NGINX server block looks like. If you can post that in a code box (three backticks, hit enter to go to a new line, paste the block, hit enter again, and close the block with three more backticks), I'll be more than happy to take a look at it for you.

The most basic of server blocks is going to look something like this (to give you a very basic example). This is actually part of one that I use (without SSL, or WordPress specific caching, rewrites, etc).

This file should be in:

/etc/nginx/sites-enabled
server {
    #+------------------------------------------------------------------------+
    #+ Defines the port that NGINX will listen on. By setting this to Port 80,
    #+ we're telling NGINX to listen in for standard HTTP connections.
    #+------------------------------------------------------------------------+
    listen 80;

    #+------------------------------------------------------------------------+
    #+ This is where we define your domain. For a standard WordPress install,
    #+ the following is ideal. For multisite, this may or may not work -- it
    #+ depends on whether you're wanting to use the sub-domain setup or the
    #+ directory setup. For sub-domain, we'd replace www.domain.com with a
    #+ WildCard entry -- *.domain.com
    #+------------------------------------------------------------------------+
    server_name domain.com www.domain.com;

    #+------------------------------------------------------------------------+
    #+ Here we're defining the root path for our domain. This is where NGINX
    #+ will look for our files (i.e. index.html, index.php, etc).
    #+------------------------------------------------------------------------+
    root /path/to/home/public_html;

    #+------------------------------------------------------------------------+
    #+ Location blocks define what happens when a request is made to specific
    #+ locations. This one handles the main entry point for your domain, /.
    #+------------------------------------------------------------------------+
    location / {
        try_files $uri $uri/ =404;
    }

    #+------------------------------------------------------------------------+
    #+ This is where we'll handle PHP requests using PHP-FPM.
    #+
    #+ fastcgi_split_path_info handles PATH_INFO
    #+ fastcgi_pass tells NGINX how to connect to PHP-FPM **
    #+ fastcgi_index defines the index file for PHP-FPM
    #+
    #+ The rest of the lines handle various configuration for PHP-FPM.
    #+
    #+ ** This block is connecting over a TCP connection. The default setup
    #+ for PHP-FPM is to connect via sockets. It all depends on how you've
    #+ setup PHP-FPM and what is defined in each of the ./pool.d/ files.
    #+
    #+ The ./pool.d/ directory can be found (on most installations) at:
    #+ /etc/php/PHP_VERS/fpm/pool.d
    #+
    #+ Where PHP_VERS is your PHP version (i.e. 5.6, 7.0, 7.1)
    #+------------------------------------------------------------------------+
    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;

        fastcgi_param  SCRIPT_FILENAME    $request_filename;

        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 180;
        fastcgi_read_timeout 180;
        fastcgi_buffer_size 512k;
        fastcgi_buffers 512 16k;
        fastcgi_busy_buffers_size 1m;
        fastcgi_temp_file_write_size 4m;
        fastcgi_max_temp_file_size 4m;
        fastcgi_intercept_errors off;

        fastcgi_param  PATH_INFO          $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;

        fastcgi_param  QUERY_STRING       $query_string;
        fastcgi_param  REQUEST_METHOD     $request_method;
        fastcgi_param  CONTENT_TYPE       $content_type;
        fastcgi_param  CONTENT_LENGTH     $content_length;

        fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
        fastcgi_param  REQUEST_URI        $request_uri;
        fastcgi_param  DOCUMENT_URI       $document_uri;
        fastcgi_param  DOCUMENT_ROOT      $document_root;
        fastcgi_param  SERVER_PROTOCOL    $server_protocol;
        fastcgi_param  REQUEST_SCHEME     $scheme;
        fastcgi_param  HTTPS              $https if_not_empty;
        fastcgi_param  HTTP_PROXY         "";

        fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
        fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

        fastcgi_param  REMOTE_ADDR        $remote_addr;
        fastcgi_param  REMOTE_PORT        $remote_port;
        fastcgi_param  SERVER_ADDR        $server_addr;
        fastcgi_param  SERVER_PORT        $server_port;
        fastcgi_param  SERVER_NAME        $server_name;

        fastcgi_param  REDIRECT_STATUS    200;
    }
}
Have another answer? Share your knowledge.