我正在使用Debian X64,我有tomcat,托管多个webapps,工作正常。
我正在运行一个托管import logging
from scrapy.utils.log import configure_logging
configure_logging(install_root_handler=False)
logging.basicConfig(
filename='log.txt',
filemode = 'a',
format='%(levelname)s: %(message)s',
level=logging.DEBUG
)
的Apache网络服务器,我希望在调用CMS
时打开它。
现在,Tomcat有2个webapps,它们会根据www.domain-cms.com
和www.domain-tom1.com
等网址再次调用
现在我的问题是如何一起运行并根据URL进行区分。我做了以下更改,请让我知道我错过了什么。
Tomcat的server.xml:
www.domain-tom2.com
apache2.conf:
我已将其添加到其中,但似乎错误,因为我想根据网址重定向,但不知道要添加什么。
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat">
<Connector port="80" protocol="org.apache.coyote.http11.Http11NioProtocol" compression="force" compressionMinSize="1024"
connectionTimeout="20000" maxPostSize="5242880"
URIEncoding="utf-8"
compressableMimeType="text/html,text/xml,text/plain,text/css,text/ javascript,application/x-javascript,application/javascript"/>
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxPostSize="5242880" SSLEnabled="true" maxThreads="200" compre$
compressionMinSize="1024" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS"
keystoreFile="keystorefile" keystorePass="PASSWORD" URIEncoding="utf-8"
compressableMimeType="text/html,text/xml,text/plain,text/css,text/ javascript,application/x-javascript,application/javascript"/>
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"/>
<Host name="domain-first.com" autoDeploy="true" unpackWARs="true" appBase="tooltank_webapps">
<Alias>www.domain-first.com</Alias>
<Context path=""/>
</Host>
<Host name="domain-second.com" autoDeploy="true" unpackWARs="true" appBase="aupair_webapps">
<Alias>www.domain-second.com</Alias>
<Context path=""/>
</Host>
<Connector port="8010" protocol="AJP/1.3" redirectPort="443" URIEncoding="utf-8"
compressableMimeType="text/html,text/xml,text/plain,text/css,text/ javascript,application/x-javascript,application/javascript"
/>
</Engine>
workers.properties文件:
<IfModule jk_module>
JkWorkersFile /etc/apache2/workers.properties
JkLogLevel INFO
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
// I think below is wrong, I want to redirect based on URL.
SetEnvIf Request_URI "/error/*" no-jk
SetEnvIf Request_URI "/blog*" no-jk
JkMount / tomcat
JkMount /* tomcat
</IfModule>
(END)
现在每当我尝试启动Apache时,都会收到错误:
worker.list=tomcat
# Set properties for worker (ajp13)
worker.worker.type=ajp13
worker.worker.host=127.0.0.1
worker.worker.port=8010
(END)
如何连接Apache服务器和tomcat,并根据URL并行提供CMS和webapps。请告诉我。谢谢。 : - )
答案 0 :(得分:1)
1)端口80通常由httpd apache服务器使用,而您正在将它用于Tomcat,因为我在您的server.xml中看到<Connector port="80"
2)在server.xml中添加虚拟主机以引导Tomcat中的不同网站,例如:
<Host name="domain-tom1.com" appBase="/var/java/apache-tomcat-7.0.47/webapps/">
<Context path="" docBase="direcory-in-webapps"/>
<Alias>www.domain-tom1.com</Alias>
</Host>
<Host name="domain-tom2.com" appBase="/var/java/apache-tomcat-7.0.47/webapps/">
<Context path="" docBase="direcory2-in-webapps"/>
<Alias>www.domain-tom2.com</Alias>
</Host>
您可以在</hots>
和</Engine>