wordpressnginxhttp-redirectbindvirtualmin

Server on virtualmin keeps redirecting to wrong website com WP multisite


When I enabled MultiSite Wordpress, it redirected to one of the Virualmin sites

I tried to put it as a subdomain, I registered it as DNS. As a subdirectory I tried to include it in the NGINX settings.

######### subdirectory #######

 location / {
            index index.php index.html index.htm;
            try_files $uri $uri/ /index.php?q=$uri&$args;
    }
location /layout-1/ {
            index index.php;
            try_files $uri $uri/ /layout-1/index.php?q=$uri&$args;
    }    
         
location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
  ########## use this or this depends on the configuration ######
1 - ###     fastcgi_pass unix:/run/php/php7.3-fpm.sock;
2 - ###  fastcgi_pass localhost:8009;
########################################################
       fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_read_timeout 3000;

;

Should the BIND have an external or internal IP in the domain? I use only one IP for all servers, and in BIND all domains are with external IP. (The question is whether it should be external or internal IP).

Would NGINX have any configuration? How to remove the IP and just put (listen IP: 80) instead of (listen 288.218.198.981:80)

But which configuration would work in general? So you can always avoid complex edits ... For example ... After creating an internal subdomain ...


Solution

  • You have to use all your bind directives in nginx in the same manner. You can use the bind directive in nginx in 2 ways:

    listen server_ip:80;
    
    listen 80;
    

    The ideea is that you have to use it one way or another everywhere in your nginx vhosts. If you mix them (one nginx vhost uses listen ip:80; and other listen 80;), it will result in some domains not redirecting or loading properly.

    If your server has a private ip then use the private ip. If the server has public ip then use the public ip. You just have to decide which syntax you're going to use.

    If you have multiple ip addresses assigned to your server I would recommend you to use the listen ip:80; method