• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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