如何在 apache2 ubuntu 上重定向 403

如何在 apache2 ubuntu 上重定向 403

http://ipAddress当我在浏览器的地址栏中输入 时,它起作用了。当我输入 时https://ipAddress,它返回NotSecured website。我该如何更改配置以使其生成 403 错误?

<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName xxxxxxxxxxx
DocumentRoot /var/www/html/xxxxxxx/public      
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCertificateFile  /etc/ssl/www_xxxxxx_com_xx.crt
SSLCertificateKeyFile   /etc/ssl/private.key
SSLCertificateChainFile /etc/ssl/www_xxxxxx_com_xx.ca-bundle.crt

<FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
        SSLOptions +StdEnvVars
</Directory>

       Alias /new /var/www/html/alias2
       <Directory /var/www/html/alias2/>
           Options Indexes FollowSymLinks
           Require all granted
       </Directory>

      Alias /online /var/www/html/alias1
       <Directory /var/www/html/alias1/>
           Options Indexes FollowSymLinks
           Require all granted
       </Directory>

       
       <Directory /var/www/html/main/public/>
           Options Indexes FollowSymLinks
           Require all granted
       </Directory>
      </VirtualHost>

     <VirtualHost *:80>
     ServerName xxxxxxxxxxx
     ServerAdmin webmaster@localhost
     Redirect 403 /
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
     </VirtualHost>

    <VirtualHost ipAddress:443>
    ServerName xxxxxxxx
    DocumentRoot /var/www/html/xxxxx/public/
    SSLEngine on
    SSLCertificateFile  /etc/ssl/www_xxxxxx_com_xx.crt
    SSLCertificateKeyFile   /etc/ssl/private.key
    SSLCertificateChainFile /etc/ssl/www_xxxxxx_com_xx.ca-bundle.crt
   </VirtualHost>

相关内容