# nginx.conf:
------------------------------------------------------------------------
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
#----------------------------------------------------------------------
# Events Module
#
# http://wiki.nginx.org/NginxHttpEventsModule
#
#----------------------------------------------------------------------
events {
worker_connections 1024;
use epoll;
}
#----------------------------------------------------------------------
# HTTP Core Module
#
# http://wiki.nginx.org/NginxHttpCoreModule
#
#----------------------------------------------------------------------
http {
upstream tornadoserver {
server 127.0.0.1:8888;
server 127.0.0.1:8889;
}
include /etc/nginx/mime.types;
#include /etc/nginx/conf.d/virtual.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
' "$http_user_agent" "$http_x_forwarded_for" ';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;
#
# The default server
#
server {
listen 80;
server_name xlquest.web;
#charset koi8-r;
#access_log logs/host.access.log main;
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
# /etc/nginx/conf.d/virtual.conf
------------------------------------------------------------------------
server {
listen 80;
server_name ilugc.web;
location / {
proxy_pass http://127.0.0.1:8888;
}
location /sitemedia/ {
root /home/lawgon/ilugc/;
}
location /smedia/ {
root /home/lawgon/;
}
location /media/ {
root /home/lawgon/django-trunk/django/contrib/admin/;
}
}
server {
listen 80;
server_name conference.web;
location / {
proxy_pass http://127.0.0.1:8889/;
}
location /2009/ {
proxy_pass http://127.0.0.1:8889/;
}
location /sitemedia/ {
root /home/lawgon/conference/;
}
location /smedia/ {
root /home/lawgon/;
}
location /media/ {
root /home/lawgon/django-trunk/django/contrib/admin/;
}
}
# python script to run django on tornado
------------------------------------------------------------------------
#! /usr/bin/env python
import os
import tornado.httpserver
import tornado.ioloop
import tornado.wsgi
import sys
import django.core.handlers.wsgi
sys.path.append('/home/lawgon/')
def main():
os.environ['DJANGO_SETTINGS_MODULE'] = 'ilugc.settings'
application = django.core.handlers.wsgi.WSGIHandler()
container = tornado.wsgi.WSGIContainer(application)
http_server = tornado.httpserver.HTTPServer(container)
http_server.listen(8888)
tornado.ioloop.IOLoop.instance().start()
if __name__ == "__main__":
main()
Комментариев нет:
Отправить комментарий