Multisite new sites not found(404), main site still works [closed]

I’ve faced the same error with both Nginx and Apache installed. Nginx works as a reverse proxy and serves static files. Because of this reason you have to insert the following code inside server directive:

if ( !-e $request_filename ) {
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;  
    rewrite ^(/[^/]+)?(/wp-.*) $2 last;                     
    rewrite ^(/[^/]+)?(/.*\.php) $2 last;                   
}

If you use Nginx as reverse proxy for static files you have to put the code listed above inside a location. i.e:

location ~ ^.+\.(jpg|jpeg|gif|png|webp|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js|JPG|JPEG|GIF|PNG|ICO|CSS|ZIP|TGZ|GZ|RAR|BZ2|DOC|XLS|EXE|PDF|PPT|TXT|TAR|WAV|BMP|RTF|JS) {
if ( !-e $request_filename ) {
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    rewrite ^(/[^/]+)?(/wp-.*) $2 last;
    rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}

If you run nginx + php-fpm (no Apache and further url rewriting with mod_rewrite involved) you have to put the code inside server directive.