Search code examples
apacheplesk

How to customize vhost.conf on plesk 12.5?


I should edit my vhost.conf for one domain on my VPS. I use plesk 12.5 on centos 7.

I should add directive:

ServerAlias "*.foo.bar"

to permit wordpress to manage multisite.

I have followed many guides, but I'm not be able to edit configuration.

I have tried to edit /var/www/vhosts/foo.bar/conf/vhost.conf , but file not exist. I have created this one and i have added directive. After that i have launched:

/usr/local/psa/admin/sbin/httpdmng --reconfigure-all
service httpd restart

But Plesk ignore this file.

I have even tried to add directive on Plesk > Subscription > domain.tld > Apache & Nginx Settings (http and https), but plesk still ignoring me.

Any hint to solve?


Solution

  • Because of nginx corresponded derictives should be added not only in vhost.conf but in vhost_nginx.conf as well (note for system folder):

    # for apache
    printf '\nServerAlias "*.foo.bar"\n' >> /var/www/vhosts/system/foo.bar/conf/vhost.conf
    chgrp apache /var/www/vhosts/system/foo.bar/conf/vhost.conf
    
    # for nginx
    printf '\nserver_name *.foo.bar;\n' >> /var/www/vhosts/system/foo.bar/conf/vhost_nginx.conf
    chgrp nginx /var/www/vhosts/system/foo.bar/conf/vhost_nginx.conf
    

    Same for Plesk > Subscription > foo.bar > Apache & Nginx Settings (http and https and nginx)