我认为运行几个 paste 实例没有什么问题,但你应该考虑使用 FastCGI(或 wsgi)和虚拟主机,因为它更适合“生产环境”。FastCGI 示例:
pid /var/run/nginx.pid;
user www;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/mime.types;
default_type application/octet-stream;
sendfile on;
gzip on;
keepalive_timeout 65;
# First site
server {
listen *:443;
server_name first.example.com;
ssl on;
ssl_certificate /etc/www/cert.pem;
ssl_certificate_key /etc/www/key.pem;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
location / {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS on;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;
}
access_log /var/log/first.access.log main;
error_log /var/log/first.error.log;
}
# Second site
server {
listen *:443;
server_name second.example.com;
ssl on;
ssl_certificate /etc/www/cert1.pem;
ssl_certificate_key /etc/www/key1.pem;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
location / {
fastcgi_pass 127.0.0.1:9001;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS on;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;
}
access_log /var/log/second.access.log main;
error_log /var/log/second.error.log;
}
}
现在,您必须站点:
first.example.com -> localhost:9000
second.example.com -> localhost:9001
您还可以为“监听”设置 IP,例如:
listen 192.168.1.1:443;
listen 192.168.1.2:443;
因此您可以使用 IP 而不是 DNS 名称。
对于 Pylons 应用程序,您应该将配置更改为 FastCGI:
[server:main]
use = egg:Flup#fcgi_thread
host = 127.0.0.1
port = 9000
对于第一个主机,第二个:
[server:main]
use = egg:Flup#fcgi_thread
host = 127.0.0.1
port = 9001
希望这可以帮助。