Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2022-12-26 15:00:07

emge
New Member
Registered: 2022-10-21
Posts: 6

Migrated from Apache to Nginx and now Admin Section has no Styling

I originally installed and was using Textpattern with Apache. Last week I shutdown Apache and installed/configured Nginx instead. I used the example Nginx configuration from the Textpattern documentation. The site itself is working perfectly fine. But it’s as if the Admin section is unable to apply any CSS? I’m still poking around, but wondering if anyone might have any suggestions as to what to look at specifically. Searching around the forums and online I’m not really finding anything that seems to align with the issue I’m having. Thanks for any help.

Offline

#2 2022-12-27 09:17:14

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,734
Website

Re: Migrated from Apache to Nginx and now Admin Section has no Styling

Hi emge,

Can you take a look at the admin-side using your browser’s web inspector / developer tools?

The network tab (and the console tab) of the dev tools shows you files that are failing to load in red and to the right often the reason why, e.g. whether not found at the path or whether they’ve been blocked from loading for some reason. Check, for example, that the file path is correct. If it does look correct, check whether you can load that file directly in a new browser tab. If it shows another error, post back here with the error it shows.

Textpattern does work fine with nginx. The primary difference is that the .htaccess file is apache-specific and has no effect on nginx. For normal use there’s no difference but if you have added your own custom rules to htaccess, you’ll need to adapt those in your nginx server blocks.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2022-12-27 12:15:53

emge
New Member
Registered: 2022-10-21
Posts: 6

Re: Migrated from Apache to Nginx and now Admin Section has no Styling

Actually right after I posted this yesterday I noticed an error regarding the admin css file saying it couldn’t load it because it’s not a mime type of text/css. I checked the file on the server and it is indeed showing as text/plain. So I was trying to figure out what was causing that. I have not done anything different with the .htaccess files.

Edit: Also, if I copy the link to the CSS file from the inspector panel and paste into the browser, I can download the CSS file, so it does not appear to be blocking access to the file at all, nor does the path to the file appear to be wrong.

Last edited by emge (2022-12-27 14:25:26)

Offline

#4 2022-12-27 15:48:18

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,734
Website

Re: Migrated from Apache to Nginx and now Admin Section has no Styling

The mime-type error is probably a good clue as to why it’s not showing, although I wasn’t aware that would block css from loading entirely. As you can load it in the browser, the file path does seem to be correct.

I’m not very knowledgeable about nginx – Pete / gaekward is our resident expert – but when I google “nginx mime-type text/css”, it would seem to be a common problem that people resolve by amending their nginx server config. There are many search results and varying pieces of advice so I can’t direct you to one that is clearly the solution but maybe there’s a solution among them.


TXP Builders – finely-crafted code, design and txp

Offline

#5 2022-12-27 17:03:37

emge
New Member
Registered: 2022-10-21
Posts: 6

Re: Migrated from Apache to Nginx and now Admin Section has no Styling

Well. I guess the search terms I was using were not as good as the ones you used. I fixed it by adding a section to the nginx conf file for my textpattern site as such:

location ~ \.css {
  add_header Content-Type        text/css;
}

I did notice that the <head> import for the admin css does not define the content type, which I believe is pretty typical/common to include. I guess that must be why I’m needing to add this to the nginx config. I wonder if there is a particular reason that the content type isn’t included for the admin section. I re-themed the main site CSS, but I never touch any of the admin side, so I assume that’s default and not something I had done.

Anyhow, thank you for the help. Very much appreciated.

Offline

Board footer

Powered by FluxBB