• 8
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Apache using multiple domains with SSL in only 1

I have an VPS working with apache2. My problem is, i have 2 projects:
1. example.com
2. admin.example.com
I have an SSL certificate (only valid for) example.com My problem is, when i access to admin.example.com, the web server is serving my the master project(like i access to example.com). Same problem if i access by ip. I have 2 virtual host configurated. I'm redirecting to https with the .htaccess file

my example.com conf file:

<VirtualHost example.com:80>
    ServerAdmin webmaster@example.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot "/var/www/example.com/public"
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<IfModule mod_ssl.c>
    <VirtualHost example.com:443>
            ServerAdmin webmaster@example.com
            ServerName example.com
            ServerAlias www.example.com
            DocumentRoot "/var/www/example.com/public"
            SSLEngine on
            SSLCertificateFile /etc/ssl/example.com/example.com.crt
            SSLCertificateChainFile /etc/ssl/example.com/example.com.intermediate.ca
            SSLCertificateKeyFile /etc/ssl/example.com/example.com.key
    </VirtualHost>
</IfModule>

enter image description here

my admin.example.com conf file

<VirtualHost admin.example.com:80>
    ServerAdmin webmaster@example.com
    ServerName admin.example.com
    ServerAlias www.admin.example.com
    DocumentRoot "/var/www/admin.example.com/public"
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
    • Then, when i have 1 ssl for example.com, i cannot use example.org or egm.com in the same vps? How works a shared hosting then?
      • 2
    • In a server can have different host with and without certificate, in a varied way. I'm sure of it
      • 2
    • As Michael Hampton says you need a valid certificate for the other domain or you will always get an SSL warning from your favourite browser. Apache will allow you to server as many different names as you want but SSL certificate must much the name of the virtualhost in the servername directive or serveralias, or your favourite browser will complain

Trending Tags