• 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

httpd.include and vhost.conf question

M

Mr.Yes

Guest
Hi,

i need to add this line to "httpd.include" file on one domain:

ServerAlias *.mydomain.com


BUT i know this file will be overwritten by plesk so i created a "vhosts.conf" file where i have only:

<VirtualHost 77.32.43.55:80>
ServerAlias *.mydomain.com
</VirtualHost>

THEN go 2 terminal to say:
/usr/local/psa/admin/bin/websrvmng -u --vhost-name=mydomain.com

THEN i try to restart Apache

BUT Apache do not restart and i had to delete vhost.conf file to have it UP again.

Can you help me to write correctly my vhost.conf file?

Thanx
 
The containing VirtualHost block is causing the problem; this is already taken care of in httpd.include. Just add the ServerAlias line to vhost.conf.

adam
 
Hi

I would like to do the same thing but for every domain that i install. So do i add this to the vhosts.conf skeleton file for each domain.

However, is there a variable that i can use for the domain, as obvioulsy this will change for each domain created, like:

ServerAlias *.{domain}

or something similiar.

Any help here would be very much appreciated.

Many thanks

Joe
 
yes there is:


use @domain_name@ as a variable in your file vhost.conf in skeleton directory. plesk will substitute this variable with the domain name at the creation process.


there are more variables like this...unfortunalty i didn't find a reference guide so far....someone?


greets
 
Hi, thats great, thanks for that.

Basically what i am trying to achieve is as follows:

By adding the ServerAlias *.domain to my domains vhost.conf file, all subdomains by default will be handled by my main domains httpdocs folder, this is great for me and the apps i build.

However, if i want to point a subdomain to another application, i would normally in plesk create a subdomain, and use the folder that it creates.

Plesk includes the vhost files in the following way:

<VirtualHost *:80>
# main domain
</VirtualHost>

<VirtualHost *:80>
# sub domain 1
</VirtualHost>

<VirtualHost *:80>
# sub domain 2
</VirtualHost>

This creates the problem in that that if i add the universal alias to the main domain, as it appears above the subdomains in the http.conf file, it overrides their settings.

I could combine these two if there is a way of moving the subdomains virtual host elements above the main domains one.

I'm not too sure if this would have any other detremental effects though with the plesk setup, but it would allow me to handle all subdomains by my main domain, unless a subdomain is specifically created in plesk.

Anybody know if this is possible to configure in plesk.
 
Back
Top