• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Where to set AllowOverride for virtualhost

bsssrl

New Pleskian
I need to set .htaccess in a specific folder in order to set Access-Control-Allow-Origin. This .htaccess is ignored. So I've to AllowOverride in apache configuration.
I tried in /etc/apache2/apache2.conf under <Directory /var/www/> and in /var/www/vhosts/system/{myhost}/conf/httpd.conf under <Directory /var/www/vhosts/{myhost}/httpdocs.
I also tried to create custom.conf file in /etc/apache2/ and /var/www/vhosts/system/{myhost}/conf/ with:

<Directory /var/www/vhosts/{myhost}/httpdocs>
AllowOverride All
</Directory>

But it is ignored. Where I can set AllowOverride for a vhost?
 
/etc/apache2/conf.d/ or /etc/httpd/conf.d/ doesn't exist, and creating conf.d and a .conf file inside those folders has no effect.
Under /etc/apache2 exists also apache2.conf. Editing directly this file has no effect.

However in /var/www/vhosts/system/{myhost}/conf/httpd.conf is specified to not directly edit the file, but instead to create /var/www/vhosts/system/{myhost}/conf/vhost.conf and /var/www/vhosts/system/{myhost}/conf/vhost_ssl.conf. So I copied from that kb and pasted into those files:



AccessFileName .htaccess

<Directory "/var/www/vhosts">
Options +All
AllowOverride All
Order allow,deny
Allow from all
</Directory>

But nothing.

On plesk 11 I used to solve similar problems editing /etc/apache2/apache2.conf.

Seeing response from server with plesk 12 seems that http server is not apache but nginx. So the real problem is to properly configure nginx (that I don't know) or to just use apache like on plesk 11.

Solved going under Website and Domains > MyDomain > Web server settings and adding directive:

location ~ \.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js|html|xhtml)$ {
add_header Access-Control-Allow-Origin "*";
}

Also disabling Smart static files processing is a solution in my case.
 
Last edited:
Back
Top