子目录nginx中的Wordpress



嗨,我有一个Nginx服务器,运行wp没有问题。我刚刚在空白的html5中创建了一个网站,并用php添加了一些功能。然后我的客户决定也建一个博客。所以我把Wordpress安装到一个子目录中。我唯一的问题是Nginx配置,我无法解决它。我在example.com/上有这个网站,wp在example.com/wp/site/上,但即使我正确配置了所有内容,"我的管理"面板也无法工作。因此,我分享了我的代码,我将非常感谢您的帮助。我在网上找到了类似的文章,但它们一点帮助都没有。所以请看一看我的Nginxcfg这个网站,告诉我哪里出了问题。非常感谢。

    server {
  server_name domain.com;
  listen 80;
  root /var/www/domain;
  include wordpress.conf;
 location / {
 index index.php index.html index.htm;
}
  # Block PHP files in uploads directory.
  location ~* /wp/acc/wp-content/uploads/.*.php$ {
    deny all;
  }
  location ~ ^/.user.ini {
    deny all;
  }
  location /wp/acc {
    limit_except GET POST OPTIONS HEAD { deny all; }
    try_files $uri $uri/ /wp/acc/index.php?$args;
  }
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
server {
  server_name domain.com;
  listen 81;
  root /var/www/domain;
 index index.php index.html index.htm;
  include wordpress7080.conf;
 location / {
index index.php index.html index.htm;
}
  # Block PHP files in uploads directory.
  location ~* /wp/acc/wp-content/uploads/.*.php$ {
    deny all;
  }
  location ~ ^/.user.ini {
    deny all;
  }
  location / {
    limit_except GET POST OPTIONS HEAD { deny all; }
    try_files $uri $uri/ /wp/acc/index.php?$args;
  }
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}

附加信息:

Wp-config.php尚未修改。数据库中的Url正确。Wordpress.conf仅包括nginx的基本Wordpress设置。

您必须将根语句更改为服务器{}代码块中每个wordpress的目录

root /var/www/wp1;
root /var/www/wp2;

此外,您可以查看

/var/log/nginx/error* 
/var/log/nginx/access*

以获取更多有关工作情况的信息。

最新更新