Windows 上的 Apache24 仅返回“有效”,而不是虚拟主机

Windows 上的 Apache24 仅返回“有效”,而不是虚拟主机

我在 Windows 2016 服务器上为我的 Django 应用程序配置了带有 mod_wsgi 的 Apache 24,并部署了三个具有不同 IP 地址的网站。我还为每个域配置了 SSL 证书,一切运行正常,直到系统因电源原因关闭,当系统恢复时,Apache 只会为所有域返回“它有效”,除非我手动重新启动 Apache 服务。为什么会发生这种情况,请帮忙。每次断电时我都必须重新启动 Apache 服务器。

我还将一个域的 SSL 文件放在名为 server.crt、server.ca-bundle 和 server.key 的 conf 文件夹中

以下是我的虚拟主机配置

LoadFile "C:/<virtual environment directory>/Scripts/python38.dll"
LoadModule wsgi_module "c:/<virtual environment directory>/lib/site-packages/mod_wsgi/server/mod_wsgi.cp38-win_amd64.pyd"
WSGIPythonHome "C:/<python installation directory>/python38"
WSGIPythonPath "C:/<virtual environment directory>/Lib/site-packages"

NameVirtualHost domain1.com:80
<VirtualHost domain1.com:80>
  ServerAlias www.domain1.com       
  ServerName domain1.com
  Redirect permanent / https://domain1.com
</VirtualHost>

 

<VirtualHost domain1.com:443>
ServerAlias www.domain1.com      
ServerName domain1.com
ServerAdmin [email protected]
 
SSLEngine On
SSLCertificateFile "C:/<SSL certificate direcory>/<cirtificate-name>.crt"
SSLCertificateChainFile "C:/<SSL certificate direcory>/<cirtificate-name>.ca-bundle"
SSLCertificateKeyFile "C:/<SSL certificate direcory>/<cirtificate-name>.key"

Alias /static/ "C:/<project root directory>/static/"
  <Directory "C:/<project root directory>/static">
    Require all granted
  </Directory>

Alias /media/ "C:/<project root directory>/media/"
  <Directory "C:/<project root directory>/media">
    Require all granted
  </Directory>

WSGIScriptAlias / "C:/<project root directory>/fbpidi_portal/<wsgi file name>.py"
  <Directory "C:/<project root directory>/fbpidi_portal">
    <Files <wsgi file name>.py>
      Require all granted
    </Files>
  </Directory>



ErrorLog "C:/<project root directory>/logs/apache.error.log"
CustomLog "C:/<project root directory>/logs/apache.custom.log" common
</VirtualHost>


NameVirtualHost domain2.com:80
<VirtualHost domain2.com:80>
  ServerAlias www.domain2.com       
  ServerName domain2.com
  Redirect permanent / https://domain2.com
</VirtualHost>

 

<VirtualHost domain2.com:443>

ServerAlias www.domain2.com       
ServerName domain2.com
ServerAdmin [email protected]
 
SSLEngine On
SSLCertificateFile "C:/<SSL certificate directory>/<certificate-name>.crt"
SSLCertificateChainFile "C:/<SSL certificate directory>/<certificate-name>.ca-bundle"
SSLCertificateKeyFile "C:/<SSL certificate directory>/<certificate-name>.key"

Alias /static/ "C:/<project root directory>/static/"
  <Directory "C:/<project root directory>/static">
    Require all granted
  </Directory>

Alias /media/ "C:/<project root directory>/media/"
  <Directory "C:/<project root directory>/media">
    Require all granted
  </Directory>

WSGIScriptAlias / "C:/<project root directory>/<project name>/wsgi.py"
  <Directory "C:/<project root directory>/<project name>">
    <Files wsgi.py>
      Require all granted
    </Files>
  </Directory>



ErrorLog "C:/<project root directory>/logs/apache.error.log"
CustomLog "C:/<project root directory>/logs/apache.custom.log" common
</VirtualHost>



Listen 8080

<VirtualHost 0.0.0.0:8080>

ServerAlias 0.0.0.0      
ServerName 0.0.0.0
ServerAdmin [email protected]


Alias /static/ "C:/<project root path>/static/"
  <Directory "C:/<project root path>/static">
    Require all granted
  </Directory>

Alias /media/ "C:/<project root path>/media/"
  <Directory "C:/<project root path>/media">
    Require all granted
  </Directory>

WSGIScriptAlias / "C:/<project root path>/<app name>/wsgi.py"
  <Directory "C:/<project root path>/<app name>">
    <Files wsgi.py>
      Require all granted
    </Files>
  </Directory>



ErrorLog "C:/<project root path>/logs/apache.error.log"
CustomLog "C:/<project root path>/logs/apache.custom.log" common
</VirtualHost>

相关内容