【问题标题】:NGINX doesn't load css files (wordpress implementation)NGINX 不加载 css 文件(wordpress 实现)
【发布时间】:2018-10-23 10:46:52
【问题描述】:

我目前正在尝试使用 nginx 在子域上实现 wordpress。

我已经安装了所有依赖项(php 7.2、mariadb、mysql)并进行了配置。

当我尝试访问该网站时,这是我得到的:

更明确地说:这是我为使用 wordpress 配置 nginx 所做的:

sudo nano /etc/nginx/conf.d/location.conf

server{
   server_name subdomain.domain.fr;
   root /home/domain/wordpress/;
   location / {
      fastcgi_pass unix:/run/php/php7.2-fpm.sock;
      include fastcgi_params;
      index index.php index.html index.htm;
      try_files $uri $uri/ =404;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param SCRIPT_NAME $fastcgi_script_name;
   }
}

我的问题是,当我第一次使用 wordpress 网站时,我习惯于在页面上看到一些 CSS。当我检查此页面时,我可以看到 css 文件已包含在内,但未使用。我不明白为什么。我认为我有特权问题或其他任何问题,但这是我第一次将 nginx 与 wordpress 一起使用,所以我一定做错了什么:

感谢您的帮助

【问题讨论】:

    标签: php wordpress nginx


    【解决方案1】:

    我找到了一个完美的解决方案:

    添加这个解决了我所有的问题:

    location ~* \.(?:css|js|map|jpe?g|gif|png)$ { }
    

    感谢您的帮助

    【讨论】:

      猜你喜欢
      • 2019-01-16
      • 1970-01-01
      • 1970-01-01
      • 2016-02-09
      • 2012-04-21
      • 1970-01-01
      • 2015-10-08
      • 2017-11-18
      • 2018-05-27
      相关资源
      最近更新 更多