在nginx的一个根目录下使用多个wordpress安装

在nginx的一个根目录下使用多个wordpress安装,wordpress,nginx,subdirectory,Wordpress,Nginx,Subdirectory,是否可以在一个域下承载多个wp安装,并使用Nginx将每个安装作为子文件夹?我已经尝试了配置文件的所有可能组合,我一直被抛出404页面。如果有一种方法可以告诉try_文件在文件夹中查找所使用的每个url,那就太酷了 location / { try_files $uri $uri/ /$some-folder/index.php?$args; } 有没有办法告诉nginx它应该在文件夹中查找所使用的每个url?我所说的url是指这样的东西。与永久链接有问题 domain

是否可以在一个域下承载多个wp安装,并使用Nginx将每个安装作为子文件夹?我已经尝试了配置文件的所有可能组合,我一直被抛出404页面。如果有一种方法可以告诉try_文件在文件夹中查找所使用的每个url,那就太酷了

location / {
        try_files $uri $uri/ /$some-folder/index.php?$args;
    }
有没有办法告诉nginx它应该在文件夹中查找所使用的每个url?我所说的url是指这样的东西。与永久链接有问题

domain.com/wp-installation-1
domain.com/wp-installation-2
domain.com/wp-installation-3
我查看了stackoverflow中的其他帖子,似乎没有人找到解决方案。我应该回到阿帕奇去做这件事吗?我很惊讶nginx没有解决这个问题的方法

这是我的配置文件

server {
    listen 80;
    server_name 104.131.123.171;
    return 301 http://www.sharkstaging.com;
}


server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    index index.php index.html index.htm;

    # Make site accessible from http://localhost/
    server_name localhost;

    #this wont work so i've commented it out
    #location /wp {
    #    tryfiles $uri $uri/ /index.php?q=$uri&$args;
    #}

    #tried doing something like this but wont work, i'm sure its something wrong
    location /wp1 {
        tryfiles $uri $uri/ /wp/index.php?q=$uri&$args;
    }

    location /wp2 {
        tryfiles $uri $uri/ /wp/index.php?q=$uri&$args;
    }



    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
    #location /RequestDenied {
    #   proxy_pass http://127.0.0.1:8080;
    #}

    #error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    #error_page 500 502 503 504 /50x.html;
    #location = /50x.html {
    #   root /usr/share/nginx/html;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    #
    #   # With php5-cgi alone:
    #   fastcgi_pass 127.0.0.1:9000;
    #   # With php5-fpm:
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #   deny all;
    #}



    location = /robots.txt { access_log off; log_not_found off; }
    location ~ /\. { deny  all; access_log off; log_not_found off; }
}

如果你在这些子文件夹中安装WordPress,甚至不需要修改你的Nginx配置文件。它将开箱即用。事实并非如此,我在ubuntu最新版本上新安装了Nginx,共收到404页。我发布了我的配置文件,并在其中添加了一些注释。