How to add two domains to the same server with fixed IP

Hello friends, how are you? I have a server with a fixed IP where I have two websites hosted on the same machine running XAMPP with Apache2.4.

The domain fdisistemas.com.br
I managed to register the ssl

follow configuration of the httpd-ssl.conf file

<VirtualHost *:443>
#   General setup for the virtual host D:\xampp\htdocs\
DocumentRoot "D:/xampp/htdocs"
ServerName fdisistemas.com.br
ServerAlias www.fdisistemas.com.br
ServerAdmin diego@fdisistemas.com.br
ErrorLog "D:/xampp/apache/logs/errormenufdi.log"
TransferLog "D:/xampp/apache/logs/accessmenufdi.log"
SSLEngine on
#SSLProtocol -all +TLSv1.2
SSLCertificateFile "C:\Certbot\archive\fdisistemas.com.br-0001\cert1.pem"
SSLCertificateKeyFile "C:\Certbot\archive\fdisistemas.com.br-0001\privkey1.pem"
SSLCertificateChainFile "C:\Certbot\archive\fdisistemas.com.br-0001\chain1.pem"
</VirtualHost> 

This sometimes works perfectly, but when I try to do the same procedure on another Sunday, it's on the same machine.

<VirtualHost *:443>
#   General setup for the virtual host
DocumentRoot "D:/xampp/htdocs/MENUVIRTUAL"
ServerName menuvirtual.net.br
ServerAlias www.menuvirtual.net.br
ServerAdmin diego@menuvirtual.net.br
ErrorLog "D:/xampp/apache/logs/errormenu2.log"
TransferLog "D:/xampp/apache/logs/accessmenu2.log"
SSLEngine on
#SSLProtocol -all +TLSv1.2
SSLCertificateFile "C:\Certbot\archive\menuvirtual.net.br\cert1.pem"
SSLCertificateKeyFile "C:\Certbot\archive\menuvirtual.net.br\privkey1.pem"
SSLCertificateChainFile "C:\Certbot\archive\menuvirtual.net.br\chain1.pem"
</VirtualHost>

This error message comes from Chrome ERR_SSL_PROTOCOL_ERROR and the website does not open.

The commands run to generate the certificate of

fdisistemas.com.br

.\certbot.exe certonly --standalone -d fdisistemas.com.br

that worked

It is

.\certbot.exe certonly --standalone -d menuvirtual.net.br

it's going wrong.

I've tried to do this too

.\certbot.exe certonly --standalone -d fdisistemas.com.br -d menuvirtual.net.br

and using the same certificate for both was not the case.

I will send an image of my infrastructure

image

an important piece of information that I just noticed if I reverse the order of the VirtualHost of fdisistemas.com.br and put menuvirtual.net.br first

The host menuvirtual.net.br starts to work however

https://menuvirtual.net.br/
without being able to use www.

example https://www.menuvirtual.net.br/ (without ssl)

https://menuvirtual.net.br/ (with ssl).

fdisistemas.com.br now gives an error
ERR_SSL_PROTOCOL_ERROR

Hi @DIEGOSIERVO, and welcome to the LE community forum :slight_smile:

I've moved your topic to "HELP" as that is more appropriate than "CLIENT DEV".

The problem is likely within your Apache config.
Let's start to unravel that (messy situation) with the output os:
sudo apachectl -t -D DUMP_VHOSTS

2 Likes

He follows

VirtualHost configuration:
*:80 is a NameVirtualHost
default server fdisistemas.com.br (D:/xampp/apache/conf/extra/httpd-vhosts.conf:49)
port 80 namevhost fdisistemas.com.br (D:/xampp/apache/conf/extra/httpd-vhosts.conf:49)
alias www.fdisistemas.com.br
port 80 namevhost menuvirtual.net.br (D:/xampp/apache/conf/extra/httpd-vhosts.conf:61)
alias www.menuvirtual.net.br
port 80 namevhost serelacione.net.br (D:/xampp/apache/conf/extra/httpd-vhosts.conf:72)
alias www.serelacione.net.br
*:443 is a NameVirtualHost
default server menuvirtual.net.br (D:/xampp/apache/conf/extra/httpd-ssl.conf:85)
port 443 namevhost menuvirtual.net.br (D:/xampp/apache/conf/extra/httpd-ssl.conf:85)
alias www.menuvirtual.net.br
port 443 namevhost fdisistemas.com.br (D:/xampp/apache/conf/extra/httpd-ssl.conf:105)
alias www.fdisistemas.com.br

hmm...
That seems correct.

What is the pfSense doing with the port 443 connections?

2 Likes

just redirecting to machine with xampp server.

Cerbot ended Windows support this month. You will want to move to another ACME client.

Since you are using Apache, you may want to use mod_md.

https://httpd.apache.org/docs/2.4/mod/mod_md.html

4 Likes

just redirecting to machine with xampp server.

Can you give me a tip on how to configure it? I tried everything here to activate this module. I saw that with this feature it is not necessary to have the .pem certificate entered in virtualhost, but in modules in my httpd.conf there is not even this mod_md line to uncomment.

What does this show?

sudo apachectl -M | grep md

Should see something like (at least that's what I see on Ubuntu):

md_module (shared)
2 Likes

I can tell you what to do on Apache on Debian in my sleep, but I haven't run Apache on Windows since XP still had new car smell, and even then it was probably only the one time just to say that I had done it. I have always run Apache on Linux distributions.

You might take a look at the section that mentions LoadModule in the following Apache documentation for Windows.

https://httpd.apache.org/docs/2.4/platform/windows.html

If you find that you do not have mod_md available, you can learn how to get a copy for Windows here:

3 Likes

Loaded Modules:
core_module (static)
win32_module (static)
mpm_winnt_module (static)
http_module (static)
so_module (static)
access_compat_module (shared)
actions_module (shared)
alias_module (shared)
allowmethods_module (shared)
asis_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
dav_lock_module (shared)
dir_module (shared)
env_module (shared)
headers_module (shared)
include_module (shared)
info_module (shared)
isapi_module (shared)
log_config_module (shared)
cache_disk_module (shared)
macro_module (shared)
mime_module (shared)
negotiation_module (shared)
proxy_module (shared)
proxy_ajp_module (shared)
request_module (shared)
rewrite_module (shared)
setenvif_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)
version_module (shared)
watchdog_module (shared)
php5_module (shared)

I don't see md module loaded. See if you can load it using loadmodule or try asking on Apache friends forum.

https://community.apachefriends.org/f/

This might work. Just guessing (I don't have Apache on Windows)

LoadModule md_module modules/mod_md.so

Oh, and maybe visit ApacheLounge forum too
https://www.apachelounge.com/viewtopic.php?p=35959

3 Likes

Just updating my case after some research, the version of my apache and php were actually out of date and the module

LoadModule md_module modules/mod_md.so

It is essential for two SSL certificates to work. Therefore, for a Windows user like me, the most successful version of ready-made installable packages with Apache, MySQL and PHP was the
EasyPHP-Devserver-17.0

Then I just made the default settings and the virtualhost worked fine.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.