php - NGINX 不加载 css 文件(wordpress 实现)
问题描述
我目前正在尝试使用 nginx 在子域上实现 wordpress。
我已经安装了所有依赖项(php 7.2、mariadb、mysql)并进行了全部配置。
当我尝试访问该网站时,这是我得到的:
更明确地说:这是我为使用 wordpress 配置 nginx 所做的:
须藤纳米/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 一起使用,所以我一定做错了什么:
谢谢你的帮助
解决方案
我找到了一个完美的解决方案:
添加这个解决了我所有的问题:
location ~* \.(?:css|js|map|jpe?g|gif|png)$ { }
谢谢你的帮助
推荐阅读
- java - 在 Android Studio 中膨胀类 EditText 时出错
- c++ - VIsual Studio:避免弹出控制台并将其集成到IDE中
- android - 从 Flutter 中的 BottomNavigationBar-sceeen 导航到子屏幕
- python - 为什么 select 语句没有从数据库表中选择所有行?它每次都忽略第一个条目
- java - ClassCastException - Customer 和 Customerservice 在加载器应用程序的未命名模块中?
- python - 职位描述句子的分类方法
- file-upload - Cyberduck CLI - 如何防止鸭子在上传到保管箱时要求授权
- azure - Azure 数据工厂 V2 - 输入和输出
- python - 在图像上使用像“一维卷积”这样的二维卷积?
- react-native - react-native run-android 从错误的文件夹启动 Metro 服务器