Virtual Host configuration in Plesk Control Panel

There are two files in Plesk to configure hosts. One is http.include and another is vhost.conf.
By default Plesk uses http.include file as the default config file for creating new domains.
Both http.include and vhosts.conf files will be under
/var/www/vhosts/example.com/conf/

Virtual Host file in Plesk panel is used to redirect (not actually redirecting the domain – change physical location of httpdocs folder). In other words, two or more domain names are sharing single physical path.

Example config assumes, existing domain as domain.com and newdomain as newdomain.com
Create a new vhost.conf under
/var/www/vhosts/newdomain.com/conf/vhost.conf


Open and edit the file as follows,
#nano /var/www/vhosts/newdomain.com/conf/vhost.conf

DocumentRoot /var/www/vhosts/domain.com/httpdocs/
<Directory /var/www/vhosts/domain.com/httpdocs/>
php_admin_value open_basedir "/var/www/vhosts/domain.com /httpdocs:/tmp"
# .htaccess so cake's urls work properly
<IfModule sapi_apache2.c>
                php_admin_flag engine on
                php_admin_flag safe_mode on
                php_admin_value open_basedir "/var/www/vhosts/ domain.com /httpdocs:/tmp"
        </IfModule>
        <IfModule mod_php5.c>
                php_admin_flag engine on
                php_admin_flag safe_mode on
                php_admin_value open_basedir "/var/www/vhosts/ domain.com /httpdocs:/tmp"
        </IfModule>
                Options -Includes -ExecCGI
AllowOverride all
Order allow,deny
Allow from all
</Directory>
AccessFileName .htaccess
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

Save and close the file. Finally restart web service manager for Plesk as,
This command will reconfigure the new domain with vhost.conf file.
#/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=newdomain.com
/etc/init.d/httpd restart
To verify, open the file "/var/www/vhosts/domain.com /conf/http.include and vhost config should be included in the last line.

Download As PDF

No comments:

Post a Comment