0

I'm trying to move example.com from a multisite WordPress installation into its separate WordPress installation folder. I've already setup a separate database and created a new file wp-config.php for the new WordPress installation with the information needed to start the new installation. The problem is that when I switch the parameter root in the Nginx configuration file from the old multisite installation folder to the new one, the old website is still loaded by Nginx.

/etc/nginx/sites-available/example.com.conf

server {
    listen      80;
    listen      [::]:80;
    server_name example.com;
    root        /var/www/wordpress_exanoke/; # <-- this was changed to point to
                                               #     the new single site installation
                                               #     the old multisite installation
                                               #     folder is /var/www/wordpress

    if ($scheme = "http") {
        rewrite ^ https://$server_name$request_uri? permanent;
    }

    location / {
        try_files $uri @index_php;
    }

    location @index_php {
        proxy_pass       http://127.0.0.1:8090;
        proxy_set_header Host $host;
    }

    location /wp-admin {
        index index.php;
    }

    location ~* .php$ {
        try_files        $uri =404;
        proxy_pass       http://127.0.0.1:8091;
        proxy_set_header Host $host;
    }

    listen 443 ssl; # managed by Certbot
    listen [::]:443 ssl; #ipv6only=on; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/chained.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/domain.key; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    ssl_client_certificate /etc/nginx/certs/cloudflare.crt;
    ssl_verify_client on;
}
Jenny D
  • 27,780
  • 21
  • 75
  • 114
rraallvv
  • 123
  • 6
  • You say this is WordPress? That is PHP. But your configuration uses `proxy_pass` to pass to some apps on ports 8090 or 8091. What are these apps? Where is your PHP configuration? – Michael Hampton Jul 07 '19 at 18:30
  • @MichaelHampton the configuration file is a modified version of the one that appears [here](https://www.nginx.com/blog/installing-wordpress-with-nginx-unit/) in the step 3 under "**Configuring NGINX Open Source**" – rraallvv Jul 07 '19 at 20:22
  • @MichaelHampton you are right I didn't change the file `wordpress.config` under the new single-site installation folder. Thanks for pointing that out. – rraallvv Jul 07 '19 at 20:27

2 Answers2

2

It turned out that you are using NGINX Unit to serve your PHP code. In that case you also need to change the document root in the configuration file that you provide to unit, and resubmit the API call to reload the new configuration.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
0

Did you restart the nginx server?

nginx requires restart to load the new configuration.

Use command sudo nginx -t for testing if your configuration is correct.

And sudo systemctl restart nginx to restart.

prime_hit
  • 101
  • 2