0

Cheers fellow stackers,

I kinda have to get wordpress running in a self hosted nginx environment.

More or less exactly using the suggested config from NGINX wordpress doc.

server {
    listen 443 ssl;
    server_name _;
    ssl_certificate /var/lib/nginx/PKI/www/server/cert.pem;
    ssl_certificate_key /var/lib/nginx/PKI/www/server/key.pem;
    root /var/lib/nginx/www/wordpress;
    index index.php;
    location / {
            try_files $uri uri/ /index.php?$args;

    }
    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_pass php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires max;
    }
}

Everything works mostly as expected, except for the styling. No styling seems to be applied on the site (also applies to the admin login/quickstart wizard).

Inside of the admin dashboard, everything looks fine.

CSS files are being served properly by NGINX.

sxx
  • 1
  • 1
  • 1
    If you post a link to your site we can have a look directly, which would be easier – Tim Aug 31 '21 at 23:50

1 Answers1

0

My nginx config did not include the mime.types defaults.

That seems to be affecting the nginx "Content-Type" response header, leading to it being "text/plain" instead of "text/css" ...

... which is unfortunate because none of the wordpress templates specify the content type in the request, e.g:

<link rel='stylesheet' id='wp-block-library-css'  href='https://censored.net/wp-includes/css/dist/block-library/style.css?ver=5.8' media='all' />

Should probably look anything like this, but oh well

<link rel="styleseeht" type="text/css" ...>
sxx
  • 1
  • 1
  • 1
    Please Improve your Answer, tell us what you have changed because it would help to answer this question, even IMHO this would only fit on Superuser – djdomi Sep 01 '21 at 04:51
  • 1
    Please provide additional details in your answer. As it's currently written, it's hard to understand your solution. – Community Sep 01 '21 at 04:51