Gå til innhold

Apache: ssl sertifikat for flere virtuelle domener


petterg

Anbefalte innlegg

Config er fordelt over flere filer - Hopper over config for php modulen og mime typer.

Vhost for ssl er i den siste fila.

 

/etc/apache2/conf/apache2.conf

### /etc/apache2/conf/apache2.conf
###
ServerRoot /usr/lib/apache2
ServerName domain1.no
#LockFile /etc/apache2/apache2.lock
PidFile /var/run/apache2.pid
ErrorLog logs/error_log
LogLevel warn
DocumentRoot /var/www/localhost/htdocs

### Dynamic Shared Object (DSO) Support
### 
### You should always leave these three, as they are needed for normal use.
### mod_access (Order, Allow, etc..)
### mod_log_config (Transferlog, etc..)
### mod_mime (AddType, etc...)
###
LoadModule access_module                 modules/mod_access.so
LoadModule auth_module                   modules/mod_auth.so
LoadModule auth_anon_module              modules/mod_auth_anon.so
LoadModule auth_dbm_module               modules/mod_auth_dbm.so
LoadModule auth_digest_module            modules/mod_auth_digest.so
LoadModule include_module                modules/mod_include.so
LoadModule log_config_module             modules/mod_log_config.so
LoadModule env_module                    modules/mod_env.so
LoadModule mime_magic_module             modules/mod_mime_magic.so
LoadModule cern_meta_module              modules/mod_cern_meta.so
LoadModule expires_module                modules/mod_expires.so
LoadModule headers_module                modules/mod_headers.so
LoadModule usertrack_module              modules/mod_usertrack.so
LoadModule unique_id_module              modules/mod_unique_id.so
LoadModule setenvif_module               modules/mod_setenvif.so
LoadModule proxy_module                  modules/mod_proxy.so
LoadModule proxy_connect_module          modules/mod_proxy_connect.so
LoadModule proxy_ftp_module              modules/mod_proxy_ftp.so
LoadModule proxy_http_module          modules/mod_proxy_http.so
LoadModule mime_module                   modules/mod_mime.so
LoadModule status_module                 modules/mod_status.so
LoadModule autoindex_module              modules/mod_autoindex.so
LoadModule asis_module                   modules/mod_asis.so
LoadModule info_module                   modules/mod_info.so
LoadModule cgi_module                    modules/mod_cgi.so
LoadModule cgid_module                   modules/mod_cgid.so
LoadModule vhost_alias_module          modules/mod_vhost_alias.so
LoadModule negotiation_module            modules/mod_negotiation.so
LoadModule dir_module                    modules/mod_dir.so
LoadModule imap_module                   modules/mod_imap.so
LoadModule actions_module                modules/mod_actions.so
LoadModule speling_module                modules/mod_speling.so
LoadModule userdir_module                modules/mod_userdir.so
LoadModule alias_module                  modules/mod_alias.so
LoadModule rewrite_module                modules/mod_rewrite.so

###
### New Modules for 2.0 (some are experimental)
###
LoadModule file_cache_module             modules/mod_file_cache.so
LoadModule echo_module                   modules/mod_echo.so
LoadModule charset_lite_module           modules/mod_charset_lite.so
LoadModule cache_module                  modules/mod_cache.so
LoadModule disk_cache_module             modules/mod_disk_cache.so
LoadModule mem_cache_module              modules/mod_mem_cache.so
LoadModule ext_filter_module             modules/mod_ext_filter.so
LoadModule case_filter_module            modules/mod_case_filter.so
LoadModule case_filter_in_module         modules/mod_case_filter_in.so
LoadModule deflate_module                modules/mod_deflate.so
#LoadModule optional_hook_export_module   modules/mod_optional_hook_export.so
#LoadModule optional_hook_import_module   modules/mod_optional_hook_import.so
#LoadModule optional_fn_import_module     modules/mod_optional_fn_import.so
#LoadModule optional_fn_export_module     modules/mod_optional_fn_export.so
#LoadModule bucketeer_module              modules/mod_bucketeer.so
LoadModule logio_module                  modules/mod_logio.so


Include conf/modules.d/*.conf
Include conf/commonapache2.conf
Listen 80

###
### Log configuration Section
###
<IfModule mod_log_config.c>
#Single logfile with access, agent and referer information
#This is the default, if vlogs are not defined for the main server
CustomLog logs/access_log combined env=!VLOG
#If VLOG is defined in conf/vhosts/vhosts.conf, we use this entry
#CustomLog "|/usr/sbin/apache2splitlogfile" vhost env=VLOG
</IfModule>

###
### Virtual Hosts 
###
Include conf/vhosts/vhosts.conf

###
### Performance settings Section
###
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

# prefork MPM [THIS IS THE DEFAULT]
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers         5
MinSpareServers      5
MaxSpareServers     10
MaxClients         150
MaxRequestsPerChild  0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers           5
StartThreads         5
MinSpareThreads      5
MaxSpareThreads     10
MaxThreadsPerChild  20
MaxRequestsPerChild  0
</IfModule>

 

/etc/apache2/conf/commonapache2.conf

### /etc/apache2/conf/commonapache2.conf
User apache
Group apache

ServerAdmin [email protected]

<Directory />
 Options -All -Multiviews
 AllowOverride None
 <IfModule mod_access.c>
   Order deny,allow
   Deny from all
 </IfModule>
</Directory>

<IfModule mod_userdir.c>
   UserDir public_html
</IfModule>

<IfModule mod_dir.c>
   DirectoryIndex index.html index.html.var index.php index.php3 index.shtml index.cgi index.pl index.htm Default.htm default.htm
</IfModule>

AccessFileName .htaccess

<IfModule mod_access.c>
<Files ~ "^\.ht">
   Order allow,deny
   Deny from all
</Files>
</IfModule>

UseCanonicalName Off

<IfModule mod_mime.c>
   TypesConfig conf/mime.types
</IfModule>

DefaultType text/plain

<IfModule mod_mime_magic.c>
   MIMEMagicFile conf/magic
</IfModule>

HostnameLookups Off

EnableMMAP on

<IfModule mod_log_config.c>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%v %h %l %u %t \"%r\" %>s %b %T" script
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" VLOG=%{VLOG}e" vhost

   <IfModule mod_logio.c>
       # You need to enable mod_logio.c to use %I and %O
       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
   </IfModule>

</IfModule>

ServerTokens Prod
ServerSignature On
<IfModule mod_alias.c>
   #
   # Note that if you include a trailing / on fakename then the server will
   # require it to be present in the URL.  So "/icons" isn't aliased in this
   # example, only "/icons/"..
   #
   Alias /icons/ /var/www/localhost/icons/
   Alias /doc /usr/share/doc

   ScriptAlias /cgi-bin/ /var/www/localhost/cgi-bin/
   ScriptAlias /protected-cgi-bin/ /var/www/localhost/protected-cgi-bin/
   ScriptAliasMatch ^/~([^/]*)/cgi-bin/(.*) /home/$1/public_html/cgi-bin/$2

   <IfModule mod_perl.c>
Alias /perl/ /var/www/localhost/perl/
#for Apache::Perlrun Mode
Alias /cgi-perl/ /var/www/localhost/perl/
   </IfModule>

</IfModule>
# End of Alias directives.

###
### Directives controlling the display of server-generated directory listings.
###
<IfModule mod_autoindex.c>
   IndexOptions FancyIndexing VersionSort NameWidth=*
   AddIconByEncoding (CMP,/icons/compressed.png) x-compress x-gzip

   AddIconByType (TXT,/icons/text.png) text/*
   AddIconByType (IMG,/icons/image2.png) image/*
   AddIconByType (SND,/icons/sound2.png) audio/*
   AddIconByType (VID,/icons/movie.png) video/*

   AddIcon /icons/binary.gif .bin .exe
   AddIcon /icons/binhex.gif .hqx
   AddIcon /icons/tar.gif .tar
   AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
   AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip .bz2
   AddIcon /icons/a.gif .ps .ai .eps
   AddIcon /icons/layout.gif .html .shtml .htm .pdf
   AddIcon /icons/text.gif .txt
   AddIcon /icons/c.gif .c
   AddIcon /icons/p.gif .pl .py .php .php3
   AddIcon /icons/f.gif .for
   AddIcon /icons/dvi.gif .dvi
   AddIcon /icons/uuencoded.gif .uu
   AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
   AddIcon /icons/tex.gif .tex
   AddIcon /icons/bomb.gif core

   AddIcon /icons/back.gif ..
   AddIcon /icons/hand.right.gif README
   AddIcon /icons/folder.gif ^^DIRECTORY^^
   AddIcon /icons/blank.gif ^^BLANKICON^^

   DefaultIcon /icons/unknown.gif

   ReadmeName README.html
   HeaderName HEADER.html

   IndexIgnore .??* *~ *# HEADER* RCS CVS *,v *,t

</IfModule>
# End of indexing directives.

###
### Document types.
###
<IfModule mod_mime.c>
   AddEncoding x-compress Z
   AddEncoding x-gzip gz tgz
   AddLanguage ca .ca
   AddLanguage cz .cz
   AddLanguage da .dk
   AddLanguage de .de
   AddLanguage el .el
   AddLanguage en .en
   AddLanguage es .es
   AddLanguage et .ee
   AddLanguage fr .fr
   AddLanguage he .he
   AddLanguage hr .hr
   AddLanguage it .it
   AddLanguage ja .ja
   AddLanguage ko .ko
   AddLanguage kr .kr
   AddLanguage ltz .ltz
   AddLanguage ltz .lu
   AddLanguage nl .nl
   AddLanguage nn .nn
   AddLanguage no .no
   AddLanguage pl .po
   AddLanguage pt-br .pt-br
   AddLanguage pt .pt
   AddLanguage ru .ru
   AddLanguage sv .se
   AddLanguage tw .tw
   AddLanguage zh-tw .tw

   AddDefaultCharset ISO-8859-1

   <IfModule mod_negotiation.c>
       LanguagePriority no en fr de es it da nl et el ja kr pl pt pt-br ru ltz ca sv tw
   </IfModule>

   <IfModule mod_negotiation.c>
       ForceLanguagePriority Prefer Fallback
   </IfModule>
   AddCharset ISO-8859-1  .iso8859-1  .latin1
   AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
   AddCharset ISO-8859-3  .iso8859-3  .latin3
   AddCharset ISO-8859-4  .iso8859-4  .latin4
   AddCharset ISO-8859-5  .iso8859-5  .latin5 .cyr .iso-ru
   AddCharset ISO-8859-6  .iso8859-6  .latin6 .arb
   AddCharset ISO-8859-7  .iso8859-7  .latin7 .grk
   AddCharset ISO-8859-8  .iso8859-8  .latin8 .heb
   AddCharset ISO-8859-9  .iso8859-9  .latin9 .trk
   AddCharset ISO-2022-JP .iso2022-jp .jis
   AddCharset ISO-2022-KR .iso2022-kr .kis
   AddCharset ISO-2022-CN .iso2022-cn .cis
   AddCharset Big5        .Big5       .big5
   # For russian, more than one charset is used (depends on client, mostly):
   AddCharset WINDOWS-1251 .cp-1251   .win-1251
   AddCharset CP866       .cp866
   AddCharset KOI8-r      .koi8-r .koi8-ru
   AddCharset KOI8-ru     .koi8-uk .ua
   AddCharset ISO-10646-UCS-2 .ucs2
   AddCharset ISO-10646-UCS-4 .ucs4
   AddCharset UTF-8       .utf8

   AddCharset GB2312      .gb2312 .gb
   AddCharset utf-7       .utf7
   AddCharset utf-8       .utf8
   AddCharset big5        .big5 .b5
   AddCharset EUC-TW      .euc-tw
   AddCharset EUC-JP      .euc-jp
   AddCharset EUC-KR      .euc-kr
   AddCharset shift_jis   .sjis

   AddType application/x-tar .tgz
   AddType image/x-icon .ico

   AddHandler cgi-script .cgi
   AddHandler type-map var
 
   AddType text/html .shtml
   AddOutputFilter INCLUDES .shtml
   AddHandler imap-file map
</IfModule>
# End of document types.

<Location /manual>
   Options Multiviews
   ErrorDocument 404 "The document you requested has not been installed on your system."
</Location>

###
### Customize behaviour based on the browser
###
<IfModule mod_setenvif.c>
   #
   # The following directives modify normal HTTP response behavior to
   # handle known problems with browser implementations.
   #
   BrowserMatch "Mozilla/2" nokeepalive
   BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
   BrowserMatch "RealPlayer 4\.0" force-response-1.0
   BrowserMatch "Java/1\.0" force-response-1.0
   BrowserMatch "JDK/1\.0" force-response-1.0

   #
   # The following directive disables redirects on non-GET requests for
   # a directory that does not include the trailing slash.  This fixes a
   # problem with Microsoft WebFolders which does not appropriately handle
   # redirects for folders with DAV methods.
   #
   BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
   BrowserMatch "^WebDrive" redirect-carefully
   BrowserMatch "^gnome-vfs" redirect-carefully
   BrowserMatch "^WebDAVFS" redirect-carefully
</IfModule>
# End of browser customization directives

<IfModule mod_status.c>
   <Location /server-status>
       SetHandler server-status
       <IfModule mod_access.c>
         Order deny,allow
         Deny from all
         allow from 127.0.0.1
         #Allow from .your_domain.com
       </IfModule>
   </Location>
</IfModule>

<IfModule mod_info.c>
   <Location /server-info>
       SetHandler server-info
       <IfModule mod_access.c>
       Order deny,allow
       Deny from all
       allow from 127.0.0.1
       #Allow from .your_domain.com
       </IfModule>
   </Location>
</IfModule>

<IfModule mod_perl.c>
   <Location /perl-status>
       SetHandler perl-script
<IfDefine MODPERL2>
PerlResponseHandler Apache::Status
</IfDefine>
<IfDefine !MODPERL2>
       PerlResponseHandler ModPerl::Status
</IfDefine>
       <IfModule mod_access.c>
         Order deny,allow
         Deny from all
         Allow from 127.0.0.1
       </IfModule>
   </Location>
</IfModule>

<IfModule mod_deflate.c>
   <Directory "/var/www/localhost/htdocs/manual">
     AddOutputFilterByType DEFLATE text/html
   </Directory>
</IfModule>

<Directory /var/www/localhost/htdocs>
   Options -Indexes FollowSymLinks MultiViews
   AllowOverride All
   <IfModule mod_access.c>
     Order allow,deny
     Allow from all
   </IfModule>
</Directory>

<Directory /var/www/localhost/perl>
   AllowOverride All
   Options -Indexes FollowSymLinks MultiViews ExecCGI
   <IfModule mod_access.c>
     Order allow,deny
     Allow from all
   </IfModule>
</Directory>

<Directory /var/www/localhost/cgi-bin>
   AllowOverride All
   Options ExecCGI
   <IfModule mod_access.c>
     Order allow,deny
     Allow from all
   </IfModule>
</Directory>

<Directory /var/www/localhost/protected-cgi-bin>
   AllowOverride All
   Options ExecCGI
   <IfModule mod_access.c>
     Order deny,allow
     Deny from all
     Allow from 127.0.0.1
     #allow from .your_domain.com
   </IfModule>
</Directory>

<Directory /home/*/public_html>
   AllowOverride All
   Options MultiViews -Indexes Includes FollowSymLinks
   <IfModule mod_access.c>
     Order allow,deny
     Allow from all
   </IfModule>
</Directory>

<Directory /home/*/public_html/cgi-bin>
    Options +ExecCGI -Includes -Indexes
    SetHandler cgi-script
</Directory>

<IfModule mod_perl.c>
   <Directory /home/*/public_html/perl>
       SetHandler perl-script
       PerlResponseHandler ModPerl::PerlRun
       Options -Indexes ExecCGI
<IfDefine MODPERL2>
  PerlOptions +ParseHeaders
</IfDefine>
<IfDefine !MODPERL2>
         PerlSendHeader On
</IfDefine>
   </Directory>
</IfModule>

<Directory /var/www/localhost/icons>
   Options -Indexes MultiViews
   AllowOverride None
   <IfModule mod_access.c>
     Order allow,deny
     Allow from all
   </IfModule>
</Directory>

<Directory /usr/share/doc>
   <IfModule mod_deflate.c>
     AddOutputFilterByType DEFLATE text/html
   </IfModule>
   Options Indexes FollowSymLinks
   <IfModule mod_access.c>
     Order deny,allow
     Deny from all
     Allow from 127.0.0.1
     #allow from .your_domain.com
   </IfModule>
</Directory>

<Location /index.shtml>
   Options +Includes
</Location>

<IfModule mod_perl.c>
   PerlModule Apache2::ModPerl::Registry
   #set Apache::Registry Mode for /perl Alias
   # To set subdirectories to use perl set the following 
   # and comment the orignial:
   # <Location ~ "^/perl/.*\.pl$">
   <Location  "^/perl/*.pl>
       SetHandler perl-script
<IfDefine MODPERL2>
       PerlResponseHandler Apache2::ModPerl::Registry
</IfDefine>
<IfDefine !MODPERL2>
       PerlResponseHandler ModPerl::Registry
</IfDefine>
       Options -Indexes ExecCGI
       PerlSendHeader On
   </Location>

   #set Apache::PerlRun Mode for /cgi-perl Alias
   <Location /cgi-perl/*.pl>
       SetHandler perl-script
       PerlResponseHandler ModPerl::PerlRun
       Options -Indexes ExecCGI
       PerlSendHeader On
   </Location>
</IfModule>

<IfModule mod_alias.c>
AliasMatch ^/manual(?:/(?:de|en|fr|ja|ko|ru))?(/.*)?$ "/var/www/localhost/htdocs/manual/$1"
</IfModule>

<Directory "/var/www/localhost/htdocs/manual">
   Options Indexes
   AllowOverride None
   Order allow,deny
   Allow from all

   <Files *.html>
       SetHandler type-map
   </Files>

   SetEnvIf Request_URI ^/manual/de/ prefer-language=de
   SetEnvIf Request_URI ^/manual/en/ prefer-language=en
   SetEnvIf Request_URI ^/manual/fr/ prefer-language=fr
   SetEnvIf Request_URI ^/manual/ja/ prefer-language=ja
   SetEnvIf Request_URI ^/manual/ko/ prefer-language=ko
   SetEnvIf Request_URI ^/manual/ru/ prefer-language=ru
   RedirectMatch 301 ^/manual(?:/(de|en|fr|ja|ko|ru)){2,}(/.*)?$ /manual/$1$2
</Directory>

 

/etc/apache2/conf/vhosts/vhosts.conf

################# vhosts.conf
<VirtualHost *:80>
ServerName *.domain1.no
#ServerPath / 
DocumentRoot /var/www/localhost/htdocs/br
</VirtualHost>
<VirtualHost *:80>
ServerName *.domain2.net
#ServerPath / 
DocumentRoot /var/www/localhost/htdocs/pg
</VirtualHost>

 

/etc/apache2/conf/modules.d/40_mod_ssl.conf

<IfDefine SSL>
 <IfModule !mod_ssl.c>
   LoadModule ssl_module    extramodules/mod_ssl.so
 </IfModule>
</IfDefine>

<IfModule mod_ssl.c>

Listen 443

<IfModule mod_mime.c>
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
</IfModule>

SSLPassPhraseDialog  builtin

SSLSessionCache         shm:logs/ssl_scache(128000)

SSLSessionCacheTimeout  300

SSLMutex  file:logs/ssl_mutex

SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

 

/etc/apache2/conf/modules.d/41_mod_ssl.default-vhost.conf

<IfDefine SSL>
 <IfModule !mod_ssl.c>
   LoadModule ssl_module    extramodules/mod_ssl.so
 </IfModule>
</IfDefine>

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
DocumentRoot "/var/www/localhost/htdocs/br"
ServerName *.domain1.no
ServerAdmin [email protected]
ErrorLog logs/ssl_error_log
<IfModule mod_log_config.c>
TransferLog logs/ssl_access_log
</IfModule>
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile conf/ssl/br.crt
SSLCertificateKeyFile conf/ssl/br.key

<Files ~ "\.(cgi|shtml|phtml|php?)$">
   SSLOptions +StdEnvVars
</Files>

<Directory "/var/www/localhost/cgi-bin">
   SSLOptions +StdEnvVars
</Directory>
<IfModule mod_setenvif.c>
   SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown \
   downgrade-1.0 force-response-1.0
</IfModule>
<IfModule mod_log_config.c>
CustomLog logs/ssl_request_log \
         "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteOptions inherit
</IfModule>

</VirtualHost>                         
<VirtualHost *:443>
      ServerAdmin [email protected]
      Servername *.domain2.net
      DocumentRoot "/var/www/localhost/htdocs/pg"

      <Directory /var/www/localhost/htdocs/pg/>
              Options FollowSymLinks Indexes
              AllowOverride All
              Order allow,deny
              Allow from all
      </Directory>

SSLEngine On
SSLCertificateFile conf/ssl/pg.crt
SSLCertificateKeyFile conf/ssl/pg.key
</VirtualHost>
</IfModule>

Lenke til kommentar
Videoannonse
Annonse

/etc/apache2/conf/modules.d/41_mod_ssl.default-vhost.conf

<IfDefine SSL>
 <IfModule !mod_ssl.c>
   LoadModule ssl_module    extramodules/mod_ssl.so
 </IfModule>
</IfDefine>

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
DocumentRoot "/var/www/localhost/htdocs/br"
ServerName *.domain1.no
ServerAdmin [email protected]
ErrorLog logs/ssl_error_log
<IfModule mod_log_config.c>
TransferLog logs/ssl_access_log
</IfModule>
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile conf/ssl/br.crt
SSLCertificateKeyFile conf/ssl/br.key

<Files ~ "\.(cgi|shtml|phtml|php?)$">
   SSLOptions +StdEnvVars
</Files>

<Directory "/var/www/localhost/cgi-bin">
   SSLOptions +StdEnvVars
</Directory>
<IfModule mod_setenvif.c>
   SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown \
   downgrade-1.0 force-response-1.0
</IfModule>
<IfModule mod_log_config.c>
CustomLog logs/ssl_request_log \
         "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteOptions inherit
</IfModule>

</VirtualHost>                         
<VirtualHost *:443>
      ServerAdmin [email protected]
      Servername *.domain2.net
      DocumentRoot "/var/www/localhost/htdocs/pg"

      <Directory /var/www/localhost/htdocs/pg/>
              Options FollowSymLinks Indexes
              AllowOverride All
              Order allow,deny
              Allow from all
      </Directory>

SSLEngine On
SSLCertificateFile conf/ssl/pg.crt
SSLCertificateKeyFile conf/ssl/pg.key
</VirtualHost>
</IfModule>

Problemet ditt er nok her: <VirtualHost _default_:443> Forandre den til <VirtualHost *:443>

Endret av olear
Lenke til kommentar

hmm

La til

NameVirtualHost 192.168.1.254:443

forran hver <VirtualHost>

 

Da reagerer den riktig på mapper i forhold til domenenavn, men den bruker fortsatt sertifikatet fra den første virtuelle hosten, og gir denne meldingen når apache starter:

* Starting apache2...
[Mon Nov 29 11:19:15 2004] [warn] NameVirtualHost 192.168.1.254:443 has no Virtu
alHosts                                                                   [ ok ]

 

Hvorfor kommer den advarselen?

Hvordan får man tatt i bruk riktig sertifikat?

Lenke til kommentar

Så litt på denne :/etc/apache2/conf/modules.d/40_mod_ssl.conf

 

<IfModule mod_ssl.c>
Listen 443
<IfModule mod_mime.c>
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
</IfModule>

 

Du har ikke med Listen 80. Det må være med siden SSL også bruker port 80.

Endret av olear
Lenke til kommentar

Listen 80 ligger i apache2.conf (første fila i posten). Slik jeg har forstått apache confing setter den sammen alle filene til en stor ved Include kommandoene. Det skal derfor ikke være nødvendig å liste opp port 80 i <IfModule mod_ssl.c> siden den skal lytte på 80 uansett om ssl er slått på eller ikke.

Tar jeg feil?

Lenke til kommentar

Ved å legge til Listen 80 i mod_ssl kommer denner ved oppstart av apache:

* Starting apache2...
[Mon Nov 29 23:33:23 2004] [warn] NameVirtualHost 192.168.1.254:443 has no VirtualHosts
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                                         [ !! ]

Og apache starter altså ikke.

Det den teksten refererer til er at man må lytte på begge porter hvis man skal bruke ssl - man kan altså ikke skru av port 80. Den er allerede på fordi den er definert i hovedconfig fila, og vil bli brukt enten ssl er av eller på.

Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...