我在apache2
服务器中使用了以下配置
<VirtualHost *:443>
ServerName app.example.io
DocumentRoot /var/www/example/master/workbench/workbench/static
Alias /static /var/www/example/master/workbench/workbench/static
Alias /media /var/www/example/master/workbench/workbench/media
ServerAlias www.app.example.io www.app.example.in prod.example.io
WSGIDaemonProcess app.example.io processes=1 threads=5 python-path=/.../workbench:/../.virtualenv/.../python2.7/site-packages/
WSGIProcessGroup app.example.io
WSGIPassAuthorization On
WSGIScriptAlias /api /var/www/example/master/workbench/workbench/wsgi.py
<Directory /var/www/example/master/workbench/workbench/static >
Order deny,allow
Allow from all
AllowOverride All
</Directory>
</virtualhost>
<VirtualHost *:443>
ServerName exmpl.io
ServerAlias *.*
Alias /static /var/www/example/master/workbench/workbench/static
DocumentRoot /var/www/example/master/workbench/workbench/static
RedirectMatch ^/$ http://example.io
WSGIDaemonProcess exmpl.io processes=1 threads=5 python- path=/.../workbench:/.../site-packages/
WSGIProcessGroup exmpl.io
WSGIScriptAlias / /var/www/example/master/workbench/workbench/wsgi.py
<Directory /var/www/example/master/workbench/workbench/static >
Order deny,allow
Allow from all
AllowOverride All
</Directory>
</virtualhost>
<VirtualHost *:8081>
ServerName app.example.io
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
<Location />
ProxyPass http://localhost:8080/
ProxyPassReverse http://localhost:8080/
</Location>
</VirtualHost>
根据配置,端口 8081 被配置为在主机 app.example.io 上侦听,但代替的是,它在 exmpl.io上工作。
以前可以使用
访问https://app.example.io:8081
但是现在,它已经开始收听
https://exmpl.io:8081
配置文件似乎没有错误,这可能是什么问题?
命令sudo apache2ctl -S
提供以下输出
*:443 is a NameVirtualHost
default server help.example.io (/etc/apache2/sites-enabled/myapp.conf:41)
port 443 namevhost help.example.io (/etc/apache2/sites-enabled/myapp.conf:41)
port 443 namevhost app.example.io (/etc/apache2/sites-enabled/myapp.conf:62)
alias www.app.example.io
alias www.app.example.in
port 443 namevhost exmpl.io (/etc/apache2/sites-enabled/myapp.conf:153)
wild alias *.*
*:8081 app.example.io (/etc/apache2/sites-enabled/myapp.conf:184)
,很明显,端口 8081 指向 app.example.io 。