LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 11-24-2012, 07:32 AM   #1
amit.roy
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Rep: Reputation: Disabled
Virtualhost entries gets over-written when apache httpd.conf is rebuilt


Background:
We have been trying to get a wildcard SSL working on multiple sub domains on a single dedicated address. We have two sub domains next.my-personal-website.com and blog.my-personal-website.com

Part of our strategy has been to edit the httpd.conf and add the NameVirtualHost xx.xx.144.72:443 directive and the virtualhost entries for port 443 for the subdomains there. This works good if we just edit the httpd.conf, add the entries, save it and restart the apache.


The problem:
But if we add a new sub domain from cpanel or we run the

Code:
# /usr/local/cpanel/bin/apache_conf_distiller --update
# /scripts/rebuildhttpdconf
the virtualhost entries that we added manually are no more there in the newly generated httpd.conf file. Only the virtualhost entry for the main domain for port 443 that was there before we made edits to the httpd.conf is there(assuming we are not discussing virtualhost entries for port 80).

I understand we need to put the new virtualhost entries in some include files as mentioned here in the cpanel documentation. But am not sure where to.

So the question would be where do I put the NameVirtualHost xx.xx.144.72:443 directive and the two virtualhost directive for port 443, so that they are not overwritten when httpd.conf is rebuilt/regenerated later.

Virtualhost entries:

The two virtualhost entries for the subdomains are:

Code:
<VirtualHost xx.xx.144.72:443>
    ServerName next.my-personal-website.com
    ServerAlias www.next.my-personal-website.com
    DocumentRoot /home/myguardi/public_html/next.my-personal-website.com
    ServerAdmin webmaster@my-personal-website.com
    UseCanonicalName On
    CustomLog /usr/local/apache/domlogs/next.my-personal-website.com combined
    CustomLog /usr/local/apache/domlogs/next.my-personal-website.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User myguardi # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup myguardi myguardi
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        SuexecUserGroup myguardi myguardi
    </IfModule>
    ScriptAlias /cgi-bin/ /home/myguardi/public_html/next.my-personal-website.com/cgi-bin/
    SSLEngine on

    SSLCertificateFile /etc/ssl/certs/my-personal-website.com.crt
    SSLCertificateKeyFile /etc/ssl/private/my-personal-website.com.key
    SSLCACertificateFile /etc/ssl/certs/my-personal-website.com.cabundle
    CustomLog /usr/local/apache/domlogs/next.my-personal-website.com-ssl_log combined
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
    <Directory "/home/myguardi/public_html/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
</VirtualHost>

<VirtualHost xx.xx.144.72:443>
    ServerName blog.my-personal-website.com
    ServerAlias www.blog.my-personal-website.com
    DocumentRoot /home/myguardi/public_html/blog.my-personal-website.com
    ServerAdmin webmaster@my-personal-website.com
    UseCanonicalName On
    CustomLog /usr/local/apache/domlogs/blog.my-personal-website.com combined
    CustomLog /usr/local/apache/domlogs/blog.my-personal-website.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User myguardi # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup myguardi myguardi
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        SuexecUserGroup myguardi myguardi
    </IfModule>
    ScriptAlias /cgi-bin/ /home/myguardi/public_html/blog.my-personal-website.com/cgi-bin/
    SSLEngine on

    SSLCertificateFile /etc/ssl/certs/my-personal-website.com.crt
    SSLCertificateKeyFile /etc/ssl/private/my-personal-website.com.key
    SSLCACertificateFile /etc/ssl/certs/my-personal-website.com.cabundle
    CustomLog /usr/local/apache/domlogs/blog.my-personal-website.com-ssl_log combined
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
    <Directory "/home/myguardi/public_html/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
</VirtualHost>
The full httpd.conf file I posted in earlier post is here

I really appreciate if somebody can help me out on this. Thank you.
 
Old 11-25-2012, 12:54 PM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,441

Rep: Reputation: 103Reputation: 103
You can name the file as you want and then include it in httpd.conf or apache2.conf

include vhosts.conf (example)

restart the server and that's it
 
  


Reply

Tags
apache2, subdomain, virtualhost, wildcard


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple httpd.conf entries in ps ax after restarting apache - is this normal? EnderX Linux - Newbie 3 09-24-2009 07:08 PM
Starting httpd: httpd: Syntax error on line 209 of /etc/httpd/conf/httpd.conf: Syntax sethukpathi Linux - Networking 6 04-12-2008 12:26 PM
Please amend apache conf/httpd.conf file please payjoe Linux - Newbie 7 09-21-2007 06:12 PM
Failed to start apache :Starting httpd: Syntax error on line 1027 of /etc/httpd/conf/ payjoe Linux - Newbie 3 09-21-2007 08:24 AM
httpd chokes on ScriptAlias line in Apache httpd.conf lhoff Linux - Software 1 07-14-2003 11:32 PM


All times are GMT -5. The time now is 08:29 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration