Category Archives: Plesk

Plesk Guides, Articles and Discussion

Add Charset to css and js files

I noticed that my css and js files were being served without the charset in the content type…

content-type: text/css;

It should be (source)…

content-type: text/css; charset=UTF-8

Per Domain

To resolve, login to Plesk and navigate to your domain, and click Apache & nginx Settings, scroll down to Additional nginx directives and add…

charset UTF-8;
charset_types text/plain text/css text/xml application/json application/manifest+json application/javascript application/rss+xml image/svg+xml;

as you can see, you can just list the file types as you would for gzip_types.

Server-wide

You can also apply this server-wide by creating a file in /etc/nginx/conf.d and adding the same directives I mentioned in the previous step.

# nano /etc/nginx/conf.d/charset.conf

Adding…

charset UTF-8;
charset_types text/plain text/css text/xml application/json application/manifest+json application/javascript application/rss+xml image/svg+xml;

You then just need to restart Nginx and you are done.

# systemctl restart nginx

Updated to add server-wide and image/svg+xml.

Horde ActiveSync on Plesk

If you’ve been running ActiveSync on a dedicated subdomain with Horde you’ve probably been relying on Apache Alias directives to get it working.
Now mod_php is deprecated, you don’t have that option.

You now have to set the handler for the /usr/share/psa-horde folder in Additional directives for HTTPS for the subdomain in Plesk.

I copied this over from the main webmail conf, the only change I made was to change PHP version to 7.4.

<IfModule mod_fcgid.c>
FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX plesk-php74-fastcgi
FcgidInitialEnv PP_CUSTOM_PHP_INI "/etc/psa-webmail/horde/horde/php.ini"
FcgidMaxRequestLen 134217728
FcgidPassHeader Authorization
<Directory "/usr/share/psa-horde">
<Files ~ (\.php$)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
Options +ExecCGI
</Files>
Require all granted
</Directory>
</IfModule>

I hope that helps someone.