moodle not showing CSS and theme with linux server

亡梦爱人 提交于 2019-11-30 23:58:41

This solution should work. I ran into the same problem after I migrated from local to production and I had to disable Use slash arguments in

Sites Administration > Server > HTTP.

It is the first item you see on the page. Just deselect it if it is checked and save to see if that helps.

Today i installed the latest moodle 3.2 on Linux Ubuntu server with Apache2 and PHP5.6. After successful installation, on the final screen no css or js was loading. pretty much similar to your issue. Getting ERR_CONTENT_DECODING_FAILED when url is hit

/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple-min.css 

I did some googling and found that its related to zlib compression and after enabling it in my php.ini file the problem is solved.

Locate your php.ini files, Go to php.ini file

sudo vi /etc/php/5.6/apache2/php.ini

Add or set below 2 lines

zlib.output_compression = on
zlib.output_compression_level = 6

Restart apache

sudo service apache2 restart

It will start working fine.

Related problem: https://moodle.org/mod/forum/discuss.php?d=324581#p1421502

Suman Bogati

It seems that you are viewing the moodle with standard theme.

By default in moodle the standard theme would be applied. You can choose any other theme which is available under the theme section.

To change the theme, you will to have access the theme section page as admin.

 Administration > Site administration > Appearance > Themes > Theme Selector

After select any other theme, you will have to do purge all cache.

For more information about changing the theme: Change moodle theme

If you are using nginx make sure your config file in /etc/nginx/sites-enabled/[your site] is according to the directions from moodle. Copy this config https://docs.moodle.org/32/en/Nginx

I upgraded server OS from Debian 8 to Debian 9 Stretch, and CSS stopped to work in Moodle after this.

I used ProxyPassMatch in Apache config to use PHP 7.0 for Moodle v3.x and PHP 5.6 for the rest of the sites:

ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/run/php/php7.0-fpm.sock|fcgi://localhost/var/www/"

One possible reason why this happens. As it is decribed on: https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html#env

The reason, why the ProxyPassMatch does not set the PATH_INFO is the following:

Environment Variables

In addition to the configuration directives that control the behaviour of mod_proxy, there are a number of environment variables that control the FCGI protocol provider:

  • proxy-fcgi-pathinfo: When configured via ProxyPass or ProxyPassMatch, mod_proxy_fcgi will not set the PATH_INFO environment variable. This allows the backend FCGI server to correctly determine SCRIPT_NAME and Script-URI and be compliant with RFC 3875 section 3.3. If instead you need mod_proxy_fcgi to generate a "best guess" for PATH_INFO, set this env-var. This is a workaround for a bug in some FCGI implementations. This variable can be set to multiple values to tweak at how the best guess is chosen (In 2.4.11 and later only):

    • first-dot: PATH_INFO is split from the slash following the first "." in the URL.

    • last-dot: PATH_INFO is split from the slash following the last "." in the URL.

    • full: PATH_INFO is calculated by an attempt to map the URL to the local filesystem.

    • unescape: PATH_INFO is the path component of the URL, unescaped / decoded.

    • any other value: PATH_INFO is the same as the path component of the URL. Originally, this was the only proxy-fcgi-pathinfo option.

The solution is described here: https://serverfault.com/questions/888114/missing-path-info-on-apache-2-4-php5-6-fpm-proxy-fcgi/935406#935406

SetHandler should be set in Apache config like this to solve the PATH_INFO variable problem:

<FilesMatch "\.php$">
        SetHandler  "proxy:unix:/run/php/user.sock|fcgi://localhost"
</FilesMatch>
<Proxy "fcgi://localhost/" enablereuse=on max=10>
</Proxy>

The most basic reason it might not show any CSS or styling could be improper permissions set in the Moodle data folder. If Apache cannot write to that directory then it cannot process the SCSS and generate cache files needed.

you can disable slash argument in Sites Administration > Server > HTTP but no recommended. Activate your server slash argument. Docs here: https://docs.moodle.org/36/en/Using_slash_arguments

Have you checked your web server to see if there are any error messages?

Next, have you tried looking in your web browser developer tools, to see if there are any errors there (especially 404 errors)?

Finally, make sure debugging is on for your Moodle site (right up to developer level) and see if that sheds some light on the problem.

You might also want to check that all of your Moodle data folder is writable, as otherwise Moodle may have trouble generating the cached theme files.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!