• Hi,

    I′m new to server configuration and new to this forum. I need to add some lines of code to the nginx config file to fix a database connection error which I got after switching WordPress to Multisite (subdirectory variant, *not* subdomain).

    I switched WordPress to Multisite by editing the wp-config.php file with the FTP-client *FileZilla*. I added the following line just before *‘That’s all, stop editing! Happy blogging’* in the file.

    /* Multisite */
    define(‘WP_ALLOW_MULTISITE’, true);

    Here are the steps I follow and where I get stuck:
    1. I connect to the server via SSH.
    2. I enter the command vim /etc/nginx/sites-available/mysite
    3. The config file is displayed which starts with
    *Prometheus_vHost_Begin.
    HTTPS.
    Do not edit directly.
    All changes will be lost.
    Please use a location specific
    include to customise your config.*

    **My QUESTION: How can I add a location specific include to customise my config?**

    I think I will need some further help to get my self caused database connection failure solved.

    Background:
    I followed the instructions of this great YT-tutorial >> [(117) How to Setup WordPress Multisite on Nginx – YouTube](

    • https://www.youtube.com/watch?v=S_KzKbP_w-E
    • ) << which tells me to add some lines of code to the config file which can be found at this link >> [A Comprehensive WordPress Multisite Setup Tutorial for Nginx – Tony Teaches Tech](

    • https://tonyteaches.tech/wordpress-multisite-nginx/
    • ) <<

      Here is the code I need to add if that is of any importance:

      ` # Rewrite requests to /wp-.* on subdirectory installs.
      if (!-e $request_filename) {
      rewrite /wp-admin$ $scheme://$host$uri/ permanent;
      rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
      rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
      }`

      Thank you very much in advance for any support!

      Gunnar

Viewing 1 replies (of 1 total)
  • Adding define('WP_ALLOW_MULTISITE', true); should NOT cause a database connection error, unless something else got messed up in your wp-config.php file.

    Your database connection problem has nothing to do with the Nginx rewrite config you’re trying to add.

Viewing 1 replies (of 1 total)
  • The topic ‘How can I add a “location specific include” to customize my nginx config?’ is closed to new replies.