1

I'using Wordpress + NGINX / SSL. After the installation I noticed that not all plugins are working and I get this error:

  • Did not parse stylesheet at 'mywebsite.com' because non CSS MIME types are not allowed in strict mode.

I've Centos 6.9, php 7.2. My main etc/nginx/nginx.conf looks like this:

user kleeia nginx;
worker_processes 3;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
        worker_connections  1024;
        use epoll;
        multi_accept on;
}

http {
        include /etc/nginx/mime.types;
        default_type  application/octet-stream;
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

        access_log  /var/log/nginx/access.log  main;

        #keep alive
        keepalive_timeout 65;
        keepalive_requests 100000;
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;

        #buffer size
        client_body_buffer_size      128k;
        client_max_body_size         64m;
        client_header_buffer_size    1k;
        large_client_header_buffers  4 4k;
        output_buffers               1 32k;
        postpone_output              1460;

        include /etc/nginx/conf.d/*.conf;
}

Of course I have also local configuration for my domain and subdomain. My testedev.conf in etc/nginx/conf.d/testdev.conf is about this:

server {
listen 80;
listen 443 ssl;
server_name testdev.com www.testdev.com;
root /home/testdev/testdev.com;
index index.php index.html index.htm;

gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext $
gzip_vary on;

#ssl on;
ssl_certificate mycert.cert;
ssl_certificate_key mykey.key;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5';

location / {
    root /home/testdev/testdev.com;
    try_files $uri $uri/ /index.php?$args;
    index index.php;
}

#error_page  404 /404.html;
#redirect server error pages to the static page /50x.html
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /home/testdev/testdev.com;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ { # this line
    root /home/testdev/testdev.com;
    try_files  $uri  $uri/  /index.php?$args;
    index  index.html index.htm index.php;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_intercept_errors on;
    include /usr/local/src/publicnginx/nginx-1.9.14/conf/fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
location ~ /\.ht {
    deny  all;
}

}

The ssl is Let's Encrypt. I followed a lot of articles around without success. My mime types seem to be fine in include /etc/nginx/mime.types like the following: I paste only the first part:

 types {
    text/html                             html htm shtml;
    text/css                              css;
    text/xml                              xml;
    image/gif                             gif;
    image/jpeg                            jpeg jpg;
    application/javascript                js;
    application/atom+xml                  atom;
    application/rss+xml                   rss;
 ...
 }

I cannot really see what's going on. My error log

2017/10/11 11:05:31 [error] 12824#12824: *1619 FastCGI sent in stderr: "Unable to open primary script: /home/testdev/testdev.com/upgrade.php (No such file or directory)" while reading response header from upstream, client: 185.129.148.167, server: testev.com, request: "POST /upgrade.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "testev.com"

FastCGI Permissions? Any Idea?

middlelady
  • 573
  • 2
  • 13
  • 36
  • What content-type is returned for your CSS? – janh Oct 11 '17 at 08:56
  • Name Value Server nginx/1.12.1 Transfer-Encoding Identity Content-Type text/html; charset=UTF-8 Date Wed, 11 Oct 2017 09:00:42 GMT Connection keep-alive X-Frame-Options SAMEORIGIN Expires Wed, 11 Jan 1984 05:00:00 GMT Vary Accept-Encoding Content-Encoding gzip Cache-Control no-cache, must-revalidate, max-age=0 Pragma no-cache – middlelady Oct 11 '17 at 09:01
  • I think it's parsed in text/html I see. @janh2 What can I do in this cases? It's a plugin. – middlelady Oct 11 '17 at 09:02
  • Does it respond with the correct content? I've only seen text/html for CSS-files when a (soft) 404 happened and a "Oh sorry, we did not find that" page was shown instead or a redirect to the home page happened. – janh Oct 11 '17 at 09:18
  • @janh2 It doesn't, the plugin doesn't load. I although see the rest of the WP dashboard. – middlelady Oct 11 '17 at 09:30
  • It has nothing to do with nginx/wordpress, then, but with the plugin. Either add the important details for the plugin (which one it is, how it generates your css, any helpful details you tracked down etc) or create a new question that focuses on that. – janh Oct 11 '17 at 09:48
  • Thanks @janh2 I supposed so. I've opened a request to the plugin support team. Have a great day. – middlelady Oct 11 '17 at 09:57

0 Answers0