1 prefork方式
server {
listen 80;
server_name test.tmdxy.org;
access_log /var/log/httpd/access.log main;
location / {
# host and port to fastcgi server
fastcgi_pass unix:/tmp/test_tmdxy.sock;
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_pass_header Authorization;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_intercept_errors off;
}
location ^~ /media/ {
alias /home/www/django/test_tmdxy_org/meida/;
}
location ~* ^.+\.(gif|png|jpg|jpeg|css|swf|htm|html|asp|php|jsp|js|doc|txt)$ {
root /home/www/django/test_tmdxy_org/media/;
access_log off;
}
}
2 threaded方式
server {
listen 80;
server_name test.tmdxy.org;
access_log /var/log/httpd/access.log main;
location / {
# host and port to fastcgi server
fastcgi_pass 127.0.0.1:3033;
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_pass_header Authorization;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_intercept_errors off;
}
location ^~ /media/ {
alias /home/www/django/test_tmdxy_org/meida/;
}
location ~* ^.+\.(gif|png|jpg|jpeg|css|swf|htm|html|asp|php|jsp|js|doc|txt)$ {
root /home/www/django/test_tmdxy_org/media/;
access_log off;
}
}
3.配置反向代理服务器
只需在server {}里加入
location /go/ {
proxy_pass http://192.168.1.5:8088/;
proxy_redirect http://192.168.1.5:8088/ /;
}