Wordpress installation is missing style/css

时间:2017-08-05 10:42:42

标签: css wordpress installation install

I've installed wordpress on my VPS a hundred times, this time the style/css is missing for some reason, the setup looks like this: https://image.prntscr.com/image/ETY6oXebR5aEAWI2lWSnAQ.png

If I proceed with the installation, the whole site will have it's style/css missing.

I've tried clearing out the directory and uploading a new wordpress setup file, but I get the same problem each time.

Anyone knows what could be the issue?

2 个答案:

答案 0 :(得分:0)

Okay the problem was that this domain had forced SSL on it. So via https the installation wasn't working properly. I disabled SSL and it works fine now.

答案 1 :(得分:0)

如果您是为您执行SSL / TLS的反向代理,或者在类似的情况下,wordpress需要知道这种情况(否则它将采用未加密的http并将使所有链接到未加密的引用)。如果http被重定向到https,那么这可能会导致问题。

您可以通过将网络服务器配置为添加某些标头来解决此问题,例如:对于服务器块内的Nginx,添加:

location /blog/ {
  proxy_pass http://backend:8081/;
  proxy_set_header X-Forwarded-Host $host;
  proxy_set_header X-Forwarded-Proto $scheme;
}

并且在wp-config.php中(通常在安装后创建,因此您必须在没有样式的情况下进行安装):

/**
 * Handle SSL reverse proxy
 */
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
    $_SERVER['HTTPS']='on';

if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
    $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
}

我遇到了同样的问题,并在此处发现了这一点:https://www.variantweb.net/blog/wordpress-behind-an-nginx-ssl-reverse-proxy/