Current time: 11-23-2024, 08:10 AM Hello There, Guest! (LoginRegister)


Post Reply 
ServerAlias and specific options for VHosts - manual configuration
Author Message
jmeyerdo Offline
Junior Member
*

Posts: 173
Joined: Oct 2007
Reputation: 2
Post: #1
ServerAlias and specific options for VHosts - manual configuration
Hi!

Even if I started implementation of adding/generating ServerAliases by isp-CP-webinterface I found a much more easier workaround now.
My primary goal is to use real ServerAliases and add special httpd-options to specific VHosts.

With the following small changes you can add specific .conf-files for each VHost manually on the console (ServerAlias, further options like WebDAV...). For each VHost a new subdirectory is created and all .conf-files are parsed by include-command in the ispcp.conf.

Add to "ispcp-dmn-mngr" in part "dmn_add_httpd_file_data" the following lines:

Code:
#
    # Domain config-include dir;
    #
    my $www_config = $main::cfg{'APACHE_SITES_DIR'};
    
    if (! -d "$www_config/$dmn_name") {
            $rs = make_dir(
                            "$www_config/$dmn_name",
                            "root",
                            "root",
                            0755
                            );

            return $rs if ($rs != 0);
        }

Add to "dmn_entry.tpl" the following line before </VirtualHost>:
Code:
Include conf.d/sites-available/{DMN_NAME}
If you want you can add a deletion-routine for the directory of course and you have to consider if you need this for subdomains/aliases also.

Usage:
Add .conf-files in the specific directory, i.e. an alias.conf:
Code:
ServerAlias furtherdomain.com www.furtherdomain.com
I see the following advantages/problems:
+ administrator can add ServerAlias manually - and they are not overwritten with a domain-update
+ no major changes necessary
- no automatic checks by isp-CP if a new domain is added manually as ServerAlias this way already

Is there some feedback about this "hack"?

Of course I am still considering to go ahead with my own hack to add a ServerAlias-option for isp-CP-webinterface but this will need major changes. Perhaps this is planned for a later version? Smile

Kind regards, Jens
(This post was last modified: 11-01-2007 10:06 PM by jmeyerdo.)
11-01-2007 10:03 PM
Find all posts by this user Quote this message in a reply
raphael Offline
Member
***

Posts: 474
Joined: Apr 2007
Reputation: 8
Post: #2
RE: ServerAlias and specific options for VHosts - manual configuration
Sounds interesting, I might add it in my next changeset Smile
11-02-2007 05:55 AM
Visit this user's website Find all posts by this user Quote this message in a reply
jmeyerdo Offline
Junior Member
*

Posts: 173
Joined: Oct 2007
Reputation: 2
Post: #3
RE: ServerAlias and specific options for VHosts - manual configuration
raphael Wrote:Sounds interesting, I might add it in my next changeset Smile
Is your changeset your private version or the official release?

In second case please let me know if I can "beautify" this small addon furthermore (add deletion of directory when deleting domain, add support for aliases, ...).

Kind regards, Jens
11-02-2007 06:42 AM
Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #4
RE: ServerAlias and specific options for VHosts - manual configuration
Quote:Is your changeset your private version or the official release?
This is the offical here on the site if you mean that.

Greez BeNe
11-02-2007 06:54 AM
Visit this user's website Find all posts by this user Quote this message in a reply
raphael Offline
Member
***

Posts: 474
Joined: Apr 2007
Reputation: 8
Post: #5
RE: ServerAlias and specific options for VHosts - manual configuration
... I was wondering, what is the difference between this and creating an other .conf file under sites-enabled with something like
Quote:<VirtualHost domain.tld:80>
# some extra options here
</VirtualHost>
?
Otherwise we'll have to polute some directory (can't be sites-enabled because they are automagically loaded, sites-available doesn't seem to be a good dir for them either, probably some dir under /etc/ispcp but that would cause problems when running apache chrooted)
11-02-2007 08:10 AM
Visit this user's website Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #6
RE: ServerAlias and specific options for VHosts - manual configuration
/etc/apache2/ispcp/..
11-02-2007 09:47 AM
Visit this user's website Find all posts by this user Quote this message in a reply
raphael Offline
Member
***

Posts: 474
Joined: Apr 2007
Reputation: 8
Post: #7
RE: ServerAlias and specific options for VHosts - manual configuration
I've actually tough about /etc/ispcp/apache/custom/...
11-02-2007 12:14 PM
Visit this user's website Find all posts by this user Quote this message in a reply
jmeyerdo Offline
Junior Member
*

Posts: 173
Joined: Oct 2007
Reputation: 2
Post: #8
RE: ServerAlias and specific options for VHosts - manual configuration
Hi!

Thank you for your interesting replies.

Are you sure that it is possible to duplicate the "<VirtualHost domain.tld:80>" to add more options? I will try this today.

Do I understand you correctly that you want to add one additional "custom-directory" for all option-files?
That should be possible and would need less/no changes in the daemon/template-files, correct?
You have to make sure to load this additional directory after the sites-available directory - and the administrator should use names like domain.tld.conf (but this is obvious).

Perhaps we can discuss this also based on your "future ideas" regarding the conf-structure for VHosts? On the feature list is the point: single .conf-files for every VHost. Have you any ideas about this already?

Kind regards, Jens
11-02-2007 04:51 PM
Find all posts by this user Quote this message in a reply
jmeyerdo Offline
Junior Member
*

Posts: 173
Joined: Oct 2007
Reputation: 2
Post: #9
RE: ServerAlias and specific options for VHosts - manual configuration
Hi!

I tried your suggestion now - but encountered problems.
I added an additional custom-directory and told the httpd to parse this after sites-available.

But how to declare the correct corresponding VirtualHost?
"<VirtualHost domain.tld:80>" is not possible - because the IP is registered at this part instead of the domainname.

I tried with the following - without success, too. The Aliases are not recognized.
Code:
<VirtualHost xxx.xxx.xxx.xx:80>
    ServerName test23.de
    ServerAlias test23b.de www.test23b.de www2.test23.de
</VirtualHost>

So we have to keep my solution?

Kind regards, Jens
11-02-2007 11:29 PM
Find all posts by this user Quote this message in a reply
raphael Offline
Member
***

Posts: 474
Joined: Apr 2007
Reputation: 8
Post: #10
RE: ServerAlias and specific options for VHosts - manual configuration
ok, thanks for the info.

So... the thing now is: what directory do we use? I think we should better populate some dir like /etc/ispcp/apache/custom so even subdomains and aliases have thir own, custom, .conf file.
11-03-2007 11:40 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)