nginx跨语言系统开发配置

1.安装tomcat 支持jsp   (安装过程请参考tomcat安装教程)

2.安装uwsgi   支持python(安装过程请参考uwsgi安装教程)

 gzip  on;
    lua_package_path "/usr/local/lua/lib/lua/?.lua;;"; #为支持lua,配置增加lua模块
   #配置tomcat服务器    upstream tomcat_server { 
            server 127.0.0.1:8080; 
    } 
    server {
        listen       81;
        server_name  localhost;
        charset utf-8;
        access_log  logs/access.log  main;
        location / {
            root   /home/tiger/www;
            index  index.php index.html index.htm;
        }
if (-d $request_filename) { 
            rewrite ^/(.*)([^/])$http://$host/$1$2/ permanent; 
        } 
        #jsp转发,后缀为jsp/jspx/do/wsdl则转发到tomcat服务器处理
        location ~ \.(jsp|jspx|do|wsdl)?$ { 
            proxy_set_header Host $host; 
            proxy_set_header X-Forwarded-For $remote_addr; 
            proxy_pass http://tomcat_server; 
        }        #默认处理php
        location /tiger_mopadmin/ {
if (!-f $request_filename){set $rule_0 1$rule_0;}
if (!-d $request_filename){set $rule_0 2$rule_0;}
if ($rule_0 = "21"){
rewrite /tiger_mopadmin/.* /tiger_mopadmin/index.php;
}
       }              #python项目路径(python语言,也可以直接配置后缀名,如:.py|.pyc|.pyw|.pyo.|.pyd),则转发到uwsgi服务器处理
location /tiger_mopadmin/py/ {
                      root            /home/tiger/www/tiger_mopadmin/py;
                  uwsgi_pass      127.0.0.1:9001;
                      include         /home/tiger/nginx/conf/uwsgi_params;
      access_log      /home/tiger/www/tiger_mopadmin/py/access.log;
}
location /tiger_mopadmin/py/static/ {
                      root            /home/tiger/www/tiger_mopadmin/py/static/;
}
}


你可能感兴趣的:(nginx跨语言系统开发配置)