django, nginx, uwsgi
mysite.xml
<uwsgi> <socket>127.0.0.1:8003</socket><!-- 内部端口,自定义 --> <chdir>/data/wwwroot/mysite/</chdir><!-- 项目路径 --> <module>mysite.wsgi</module> <processes>4</processes> <!-- 进程数 --> <daemonize>uwsgi.log</daemonize><!-- 日志文件 --> </uwsgi>
another one.same
nginx.conf
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; include /usr/local/nginx/conf/vhosts/*.conf; }
site1, and 2, 1.conf, 2.conf
server { listen 80; server_name site.com www.site.com; root /data/wwwroot/mysite; # 站点根目录 charset utf-8; location / { include uwsgi_params; uwsgi_pass 127.0.0.1:8003; #端口要和uwsgi里配置的一样 uwsgi_param UWSGI_SCRIPT mysite.wsgi; #wsgi.py所在的目录名+.wsgi uwsgi_param UWSGI_CHDIR /data/wwwroot/mysite; #项目路径 } location /static/ { alias /data/wwwroot/mysite/static/; #静态资源路径 } }