I’m having issues with drupal on nginx. CSS is not displaying but the website is working and I have no clue why this is happening. I have installed nginx + php70-fpm on Mac OS El Capitan and I am using the configuration from drupal website with a slight mod:
The server name is also set in my /etc/hosts
file as I am developing locally.
server { server_name drupal.mac; root /Users/fabriziomazzoni1/nginx/drupal/; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # Very rarely should these ever be accessed outside of your lan location ~* .(txt|log)$ { allow 192.168.0.0/16; deny all; } location ~ ..*/.*.php$ { return 403; } location ~ ^/sites/.*/private/ { return 403; } # Allow "Well-Known URIs" as per RFC 5785 location ~* ^/.well-known/ { allow all; } # Block access to "hidden" files and directories whose names begin with a # period. This includes directories used by version control systems such # as Subversion or Git to store control files. location ~ (^|/). { return 403; } location / { # try_files $uri @rewrite; # For Drupal <= 6 try_files $uri /index.php?$query_string; # For Drupal >= 7 } location @rewrite { rewrite ^/(.*)$ /index.php?q=$1; } # Don't allow direct access to PHP files in the vendor directory. location ~ /vendor/.*.php$ { deny all; return 404; } # controllers other than update.php in a future release. location ~ '.php$|^/update.php' { root /Users/fabriziomazzoni1/nginx/drupal/; fastcgi_split_path_info ^(.+?.php)(|/.*)$; #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini include fastcgi.conf; $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_intercept_errors on; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; } # Fighting with Styles? This little gem is amazing. # location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6 location ~ ^/sites/.*/files/styles/ { # For Drupal >= 7 try_files $uri @rewrite; } location ~* .(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } }
Attached is a screenshot of the web browser to better understand what is happening:
Sponsored by SupremePR