nginx跨語言系統開發配置

1.安裝tomcat 支持jsp   (安裝過程請參考tomcat安裝教程)php

2.安裝uwsgi   支持python(安裝過程請參考uwsgi安裝教程)html

 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/;
}
}
相關文章
相關標籤/搜索