我将Apache设置为Django的前端,它的工作正常。我还需要处理网络套接字,所以我在端口8888上运行Tornado。是否有可能让Apache成为Tornado的前端,所以我不必指定8888端口?
我当前的/etc/apache2/sites-enabled/000-default.conf文件是:
WSGIDaemonProcess myappiot python-path=/home/ubuntu/myappiot/sw/www/myappiot:/usr/local/lib/python2.7/site-packages
WSGIProcessGroup myappiot
WSGIScriptAlias / /home/ubuntu/myappiot/sw/www/myappiot/myappiot/wsgi.py
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
答案 0 :(得分:1)
您可以代理请求。例如,结帐http://amir-x.com/apache-2-reverse-proxy-tornado。
答案 1 :(得分:1)
最好在端口80上使用nginx作为前端代理,并将其代理到Apache / mod_wsgi和Tornado作为自己端口的后端。如果所有内容都正确设置,Apache / mod_wsgi实际上也会从中受益,因为nginx会将Apache与慢速HTTP客户端隔离开来,从而允许Apache以更少的资源执行更好的功能。