0

Im trying to setup a second webserver on my machine however im running into problems with the virtual hosts and im not sure which file and what i should be changing.

  1. I have 1 server running with SSL
  2. I was able to add another server with HTTP that worked.
  3. When activated SSL for that domain i've been stuck with it redirecting to the first domain.

Would someone be able to help point me in the right direction.

For extra information my router is pointing port 80 > 80 and 443 > 8443

Ignore any random typos, they are from copying text from a picture

HTTPD.conf

Listen 443
Listen 80

HTTPD-SSL.conf

Listen 8443
<VirtualHost _default_:8443>
#
General setup for the virtual host
DocumentRoot"/Library/Webserver/Documents/"
ServerName theintuitiverising.com
ServerAdmin
ErrorLog"/usr/local/var/log/httpd/error_log"
TransferLog"/us/local/var/log/httpd/access_log"
#
#
SSL Engine Switch:
Enable/Disable SSL for this virtual host.
SSLEngine on
#
#
#
#
#
#
#
#
#
#
Server Certificate:
Point SSLCertificateFile at a PEM encoded certificate.
If
the certificate is encrypted, then you will be prompted for a pass phrase. Note that a kill -HUP will prompt again. Keep in mind that if you have both an RSA and a DSA certificate you can configure both in parallel (to also allow the use of DSA ciphers, etc.)
Some ECC cipher suites (http://www.ietf.org/rfc/rfc4492.txt)
require an ECC certificate which can also be configured in parallel.
SSLCertificatefile"/usr/local/etc/certbot/certs/live/theintuitiverising.com/fullchain.pem"
#SSLCertificateFile "/us/local/etc/httpd/server-dsa.crt"
#SSLCertificatefile "/us/local/etc/httpd/server-ecc.crt"
#
#
#
#
#
#
Server Private Key:
If the key is not combined with the certificate, use this directive to point at the key file.
Keep in mind that if
you've both a RSA and a DSA private key you can configure both in parallel (to also allow the use of DSA ciphers, etc.)
ECC keys, when in use, can also be configured in parallel
SSLCertificateKeyFile"/us/local/etc/certbot/certs/live/theintuitiverising.com/privkey.pem"

HTTPD-VHOSTS.conf

‹VirtualHost *:443>
ServerAdmin
DocumentRoot"/Library/WebServer/SBD/"
ServerName https://scottbrookesdesigns.com
ErrorLog"/usr/local/var/log/httpd/scottbrookesdesigns.com-error_log"
CustomLog"/us/local/var/log/httpd/scottbrookesdesigns.com-access_log"cOmmon
SSLEngine on
SSLCertificateFile"/us/local/etc/certbot/certs/live/scottbrookesdesigns.com/fullchain.pem"
SSLCertificateKeyFile"/us/local/etc/certbot/certs/live/scottbrookesdesigns.com/privkey.pem"
</VirtualHost>
«VirtualHost *:443>
ServerAdmin
DocumentRoot"/Library/WebServer/Documents/"
ServerName https://theintuitiverising.com
ErrorLog"/usr/local/var/log/httpd/theintuitiverising.com-error_log"
CustomLog"/us/local/var/log/httpd/theintuitiverising.com-access_log common
SSLEngine on
SSLCertificateFile"/usr/local/etc/certbot/certs/live/theintuitiverising.com/fullchain.pem"
SSLCertificateKeyFile"/us/local/etc/certbot/certs/live/theintuitiverising.com/privkey.pem"
</VirtualHost>

Here is also my HTaccess files in case they can be of use

RewriteEngine On
RewriteCond * (HTTPS) off
RewriteRule ^(.*)$ https: //%{HTTP_HOST}% (REQUEST_URI) IL, R-301]
RewriteCond *{HTTP_HOST) I^theintuitiverising.coms
RewriteRule (.*) https://theintuitiverising.com/$1 [L,R=301]
RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L, R]
RewriteEngine On
RewriteCond *{REQUEST_FILENAME) 1-f
RewriteCond *(REQUEST -FILENAME) I-d
RewriteRule blog/ (.*) blog/?id-$1 [L, NC, QSA]
«FilesMatch ". (php[htm|css|¡s|txt)$">
Header set Cache-Control
</FilesMatch>
"max-age-3600, public"
«FilesMatch ". (ico|png|gif|jpg|webm|webp |mp4 |woff2|woff) $">
Header set Cache-Control "max-age=31557600, public
publici
</FilesMatch>
Header unset ETag
FileETag None

RewriteEngine On
RewriteCond *(HITPS) off
RewriteRule ^(.*)$ https: //%{HTTP_HOST}% (REQUEST_URI) [L, R-301]
RewriteCond * (HTTP_HOST} I^scottbrookesdesigns.com
RewriteRule (.*) https://scottbrookesdesigns.com/$1 [L,R-301]
RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L, R]
RewriteEngine On
RewriteCond *{REQUEST _FILENAME) 1-f
Rewritecond *(REQUEST _FILENAME) 1-d <FilesMatch ". (php|htm|css|is txt)$">
Header set Cache-Control'"max-age=3600,public"
</FilesMatch>
«FilesMatch ". (ico|png|gif |jpg|webm |webp |mp4 |woff?(woff)s">
Header set Cache-Control "max-age=31557600, publi
public"
</FilesMatch>
Header unset ETag
FileETag None

1 Answer 1

0

ServerName is not an URL, just the name.

Additionally, if your Apache is reached via port 8443 you need to reflect that in the VirtualHost definition.

<VirtualHost *:8443>
ServerName scottbrookesdesigns.com
# ...
<VirtualHost *:8443>
ServerName theintuitiverising.com
1
  • Awesome that did it, thank you Nov 6, 2022 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.