apache2 vitual host config

Discussion in 'Server Operation' started by mitho7, Jan 30, 2012.

  1. mitho7

    mitho7 Member

    Hi Team,

    i'm having some issue with vitual host set up. i have one site set up now, with SSL and working ok. I'm trying to set up another virtual host but not having luck. my set up is:

    port.conf:
    --------------
    Listen 80
    Listen 443
    NameVirtualHost *:443
    NameVirtualHost *:80
    -----------------------

    sites-available/www.site1.com
    ----------------
    <VirtualHost *:80>
    ServerAdmin admin@site1.com
    ServerName www.site1.com
    ServerAlias site1.com
    # Indexes + Directory Root.
    DirectoryIndex index.php
    DocumentRoot /var/www/site1/public_html

    # CGI Directory
    ScriptAlias /cgi-bin/ /var/www/site1/cgi-bin
    <Location /cgi-bin>
    Options +ExecCGI
    </Location>

    # Logfiles
    ErrorLog /var/www/site1/logs/error.log
    CustomLog /var/www/site1/logs/access.log combined
    </VirtualHost>
    -------------------

    sites-available/www.site1.com-ssl:
    -----------------------------------
    <VirtualHost *:443>
    ServerAdmin admin@site1.com
    ServerName www.site1.com
    ServerAlias site1.com
    # Indexes + Directory Root.
    DirectoryIndex index.php
    DocumentRoot /var/www/site1/public_html
    # CGI Directory
    ScriptAlias /cgi-bin/ /var/www/site1/cgi-bin
    <Location /cgi-bin>
    Options +ExecCGI
    </Location>
    SSLEngine on
    SSLCertificateFile /var/www/site1/ssl/www.site1.com.crt
    SSLCertificateKeyFile /var/www/site1/ssl/www.site1.com.key
    SSLCACertificateFile /var/www/site1/ssl/www_site1_com_apache.crt
    # Logfiles
    ErrorLog /var/www/site1/logs/error.log
    CustomLog /var/www/site1/logs/access.log combined
    </VirtualHost>
    ---------------------------------------------------------------------

    Above configuration is working fine. After I do "a2ensite www.site2.com" and reload apache config i can not access www.site1.com or https//www.site1.com. I tried to restart the apache as well. no errors comes up for restart and reload apache.

    config for: sites-available/www.site2.com
    -------------------------------------------
    <VirtualHost *:80>
    ServerAdmin admin@site2.com
    ServerName www.site2.com
    ServerAlias site2.com

    # Indexes + Directory Root.
    DirectoryIndex index.php
    DocumentRoot /var/www/site2/public_html

    # CGI Directory
    ScriptAlias /cgi-bin/ /var/www/site2/cgi-bin
    <Location /cgi-bin>
    Options +ExecCGI
    </Location>
    # Logfiles
    ErrorLog /var/www/site2/logs/error.log
    CustomLog /var/www/site2/logs/logs/access.log combined
    </VirtualHost>



    Hoping some help.

    Thanks,
     
  2. mitho7

    mitho7 Member

    got it sorted now.

    from apache error log
    [Tue Jan 31 21:55:29 2012] [notice] Graceful restart requested, doing restart
    Unable to open logs

    on my new virtual host config i have:

    CustomLog /var/www/site2/logs/logs/access.log combined

    i have repeted logs. so when restart could not open the log file.

    :)
     

Share This Page