Php nginx从子目录加载wordpress

Php nginx从子目录加载wordpress,php,wordpress,nginx,Php,Wordpress,Nginx,我按照来自的指南在我的ubuntu服务器上安装wordpress。输入url后,我将进入首页 server { listen 80 default_server; root /var/www/wordpress; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?q=$uri&$args; }

我按照来自的指南在我的ubuntu服务器上安装wordpress。输入url后,我将进入首页

     server {
    listen 80 default_server;

    root /var/www/wordpress;
    index index.php index.html index.htm;

    location / {
            try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    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;
    }

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

我想从我的子域加载wordpress,即。我继续修改了位置,但无法正确加载(它仍在下查找文件)


我该如何解决这个问题?谢谢你的wordpress在根目录中查找他的文件/ 所以你需要告诉他,在正确的目录中搜索他的文件/wordpress/ 有两种方法。 更好:使用wordpress配置文件更改路径以重写资源路径

最糟糕的情况:将wordpress资源重定向到根目录。大概是这样的:

  location ~ ^/images/(.*)$ {
    try_files $uri /wordpress/images/$uri =404;
    access_log off;
   }

wordpress安装目录没有一个简单的index.php文件,我可以在其中修改CSS链接文件。一个php链接到其他许多php文件的php。查找哪个php文件链接CSS太复杂了。我必须找到重定向的解决方案。如果你能帮我,那就太好了。谢谢你含糊不清的回答。我只是想说,我不太了解WP,但我想它在配置文件中有一些参数,可以用来更改资源的路径。实际上,对于css、js文件,可以使用html标记,但我认为这有点错误。我想你可以在那里找到一些帮助
    location /{
            try_files $uri $uri/ /wordpress/index.php?q=$uri&$args;
    }
/css/*, /*    etc
/wordpress/css/*, /wordpress/*   and so on. 
  location ~ ^/images/(.*)$ {
    try_files $uri /wordpress/images/$uri =404;
    access_log off;
   }