Php 如何使用apache2 virtualhost配置为两个不同的应用程序提供服务
这只是假设Php 如何使用apache2 virtualhost配置为两个不同的应用程序提供服务,php,django,magento,apache2,web-deployment,Php,Django,Magento,Apache2,Web Deployment,这只是假设 testsite.com这是我的php应用程序和 testsite.com/project是python应用程序 我的apache站点配置文件/etc/apache2/sites available/site.conf <VirtualHost *:443> ServerAdmin webmaster@testsite.com DocumentRoot /var/www/html
testsite.com
这是我的php应用程序和
testsite.com/project
是python应用程序
我的apache站点配置文件/etc/apache2/sites available/site.conf
<VirtualHost *:443>
ServerAdmin webmaster@testsite.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@testsite.com
DocumentRoot /var/www/html/test-project
<Directory /var/www/html/test-project/test-project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess test python-path=/var/www/html/test-project/test-project python-home=/var/www/html/test-project
WSGIProcessGroup test
WSGIScriptAlias / /var/www/html/test-project/test-project/wsgi.py
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
服务器管理员webmaster@testsite.com
DocumentRoot/var/www/html
ErrorLog${APACHE_LOG_DIR}/error.LOG
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
服务器管理员webmaster@testsite.com
DocumentRoot/var/www/html/test项目
要求所有授权
WSGIDaemonProcess-test-python-path=/var/www/html/test-project/test-project-python-home=/var/www/html/test-project
WSGIProcessGroup测试
WSGIScriptAlias//var/www/html/test-project/test-project/wsgi.py
ErrorLog${APACHE_LOG_DIR}/error.LOG
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
查看上面的配置,我只希望任何带有testsite.com/
的url都能从第一个virtualhost获得服务,这是我的php应用程序及其工作状态,每当只有这个特定的testsite.com/project
url点击时,应该从第二个virtualhost获得服务,这是我的python应用程序
因此,为了从第二个virtualhost获得这个urltestsite.com/project
,它必须从第一个virtualhost获得旁路。
请建议我怎么做?我应该在第一个virtualhost中做些什么,以便将它绕过到第二个
注意:这与url重写无关,因此请不要建议任何重写规则或与此相关的任何内容。很可能您正在考虑这样的问题,很可能在上问这个问题会是一个更好的选择。当然,我已经这样做了。谢谢通知!另外,如果您知道我的案例场景中的确切解决方案,那么您能详细说明吗?对不起,我不能;)只是做其他事情。我非常确定反向代理是您所寻找的,如果它适合您的需要,您可以尝试一些方法。否则,我们希望ServerFault的人能给你一些更好的线索;)