提前感谢您的帮助。
我继续让你了解我的情况。
我在服务器上配置 apache2,分配了两 (2) 个子域,我将其称为 moodle.myorganization.com.ve 和 jupyter.myorganization.com.ve。为此,我创建了两个虚拟主机,每个子域一个,并且启用了 apache 模块:rewrite、proxy、proxy_http、headers 和 proxy_wstunnel。
/etc/apache2/sites-enabled/moodle.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/moodle
ServerName moodle.myorganization.com.ve
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html/moodle/>
Options +Indexes +FollowSymLinks +MultiViews +Includes
AcceptPathInfo On
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/moodle-error.log
CustomLog ${APACHE_LOG_DIR}/moodle-access.log combined
</VirtualHost>
/etc/apache2/sites-enabled/jupyter.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName jupyter.myorganization.com.ve
<Location "/">
ProxyPreserveHost on
ProxyPass http://localhost:8000/
ProxyPassReverse http://localhost:8000/
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
</Location>
ErrorLog ${APACHE_LOG_DIR}/jupyter-error.log
CustomLog ${APACHE_LOG_DIR}/jupyter-access.log combined
</VirtualHost>
我期望每个子域都会响应相应的服务,但事实并非如此。
当我访问 jupyter.myorganization.com.ve 时,请求成功重定向到在 localhost:8000.
运行的内部 jupyter 服务访问moodle.myorganization.com.ve时,绕过Moodle虚拟主机,将请求重定向到Jupyter服务。
应该注意的是,除了子域之外,我还有一 (1) 个公共 IP,通过具有不同端口的 NAT,我将流量重定向到服务器的端口 80 和 8080(用于测试环境)。
我在两个子域中都观察到,当只居住在一个虚拟主机上时,行为是正确的。
我尝试为服务配置不同的端口:Moodle 为 80,Jupyter 为 8080。而且,我仍然无法让每个子域响应正确的服务。