• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

Any subdomain to main folder, but www.domain to subdomain folder

Hello.
I have situation below.

I need that any subdomain goes to main folder /var/www/vhosts/domain/httpdocs and that is reached with A record
*.domain.com A server's IP

but www.domain.com must be opened from another folder. I have created subdomain www for that. Thus page must be loaded from /var/www/vhosts/domain/subdomain/www/httpdocs

Everything is working if I edit /var/www/vhosts/domain/conf/httpd.include file though I must move script for www.domain.com subdomain before main virtual host like this

<VirtualHost 64.150.164.189:80>
ServerName www.domain.com:80
DocumentRoot /var/www/vhosts/domain.com/subdomains/www/httpdocs
CustomLog /var/www/vhosts/domain.com/statistics/logs/access_log plesklog
ErrorLog /var/www/vhosts/domain.com/statistics/logs/error_log
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
<Directory /var/www/vhosts/domain.com/subdomains/www/httpdocs>
<IfModule mod_php4.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/domain.com/subdomains/www/httpdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/domain.com/subdomains/www/httpdocs:/tmp"
</IfModule>
Options -Includes -ExecCGI
</Directory>
</VirtualHost>

<VirtualHost 64.150.164.189:80>
ServerName domain.com:80
DocumentRoot /var/www/vhosts/domain.com/httpdocs
CustomLog /var/www/vhosts/domain.com/statistics/logs/access_log plesklog
ErrorLog /var/www/vhosts/domain.com/statistics/logs/error_log
<IfModule mod_userdir.c>
UserDir /var/www/vhosts/domain.com/web_users
</IfModule>
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
<Directory /var/www/vhosts/domain.com/httpdocs>
<IfModule mod_php4.c>
php_admin_flag engine on
php_admin_flag safe_mode off
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 off
php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp"
</IfModule>
Options -Includes -ExecCGI
</Directory>
<Directory /var/www/vhosts/domain.com/web_users>
<IfModule mod_php4.c>
php_admin_flag engine off
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine off
</IfModule>
</Directory>
Include /var/www/vhosts/domain.com/conf/vhost.conf
</VirtualHost>

But Plesk will restore httpd.include file. Therefore I've created vhost.conf file and now there:

ServerAlias www.domain.com "www.domain.com"
ServerAlias *.domain.com "domain.com"

And Now, if I go to domain.com, www.domain.com or something.domain.com the folder /var/www/vhosts/domain/httpdocs is used.

What I should to do at vhost.conf file?
 
Last edited by a moderator:
Back
Top