Ubuntu
Apache 將 https:b-site 訪問者定向到 https:a-site(b-site 沒有 ssl)
我的 apache 系統有問題。它是全新的,我也是。
我現在的問題是,如果有人訪問https://123.446.689.0>或<https://b-site.com(沒有任何 ssl),那麼 a-site 會在 https…
一個連接怎麼會這樣跳躍?(當然會出現警告,因為 ssl 是針對另一個域的)
我將在 b 站點上獲得 ssl,但無法獲得 ssl 到 ip。並且所有直接 IP 訪問都應重定向到另一個站點。(目前是 000-預設值)
這些是我的配置文件;
a-site.com.conf
<VirtualHost a-site.com:80> ServerName a-site.com DocumentRoot /var/www/a-site.com <Directory /var/www/a-site.com> Options FollowSymLinks AllowOverride Limit Options FileInfo DirectoryIndex index.html index.php Require all granted </Directory> <Directory /var/www/a-site.com/wp-content> Options FollowSymLinks Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/a-site.error.log CustomLog ${APACHE_LOG_DIR}/a-site.log combined RewriteEngine on RewriteCond %{SERVER_NAME} =a-site.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost>
a-conf.com-le-ssl.conf
<IfModule mod_ssl.c> <VirtualHost a-site.com:443> ServerName a-site.com ServerAdmin arga@localhost DocumentRoot /var/www/a-site.com ErrorLog ${APACHE_LOG_DIR}/a-site.error.log CustomLog ${APACHE_LOG_DIR}/a-site.access.log combined SSLCertificateFile /etc/letsencrypt/live/a-site.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/a-site.com/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf Header always set Strict-Transport-Security "max-age=31536000" </VirtualHost> </IfModule>
000-default.conf
<VirtualHost 123.456.789.0:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/00 ErrorLog ${APACHE_LOG_DIR}/catchall.error.log CustomLog ${APACHE_LOG_DIR}/catchall.access.log combined </VirtualHost>
b-site.com.conf
<VirtualHost b-site.com:80> ServerName b-site.com DocumentRoot /var/www/b-site.com <Directory /var/www/b-site.com> Options FollowSymLinks AllowOverride Limit Options FileInfo DirectoryIndex index.html index.php Require all granted </Directory> <Directory /var/www/b-site.com/wp-content> Options FollowSymLinks Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/b-site.error.log CustomLog ${APACHE_LOG_DIR}/b-site.log combined </VirtualHost>
000-預設-ssl.conf
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/00 ErrorLog ${APACHE_LOG_DIR}/napto.def.error.log CustomLog ${APACHE_LOG_DIR}/napto.def.access.log combined SSLEngine on SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> </VirtualHost> </IfModule>
您只
a-site.com:443
VirtualHost
定義了埠 443 (https),因此 Apache 只顯示它可以找到顯示的站點。您需要以與您相同的方式
VirtualHost
在埠 443 上定義預設值(或檢查您是否擁有並啟用它)。您仍然需要預設主機的 TLS/SSL 證書,但您可以創建自簽名證書。基於 Debian 的系統已經為您生成了一個.<VirtualHost _default_:443>``000-default.conf``default-ssl.conf``/etc/ssl/certs/ssl-cert-snakeoil.pem