现在的位置: 首页 > 综合 > 正文

nginx+thinkphp配置参考

2014年01月29日 ⁄ 综合 ⁄ 共 1274字 ⁄ 字号 评论关闭

server {
    listen 80;
    server_name  www.webserver.cn;
    
    allow 220.181.126.42;
    allow 10.0.0.0/8;
    allow 127.0.0.0/8;
    deny all;

    access_log  logs/www.webserver.cn.log  combinedio;
    error_log logs/www.webserver.cn.log.err;

    location ~ /myusepath/.*\.(php|php5).*$ {
      root /usr/local/nginx/html/workspace/ThinkPHP/;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
        set $path_info "";
        set $real_script_name $fastcgi_script_name;
        if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                set $real_script_name $1;
                set $path_info $2;
        }
        fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
        fastcgi_param SCRIPT_NAME $real_script_name;
        fastcgi_param PATH_INFO $path_info;
         if (!-e $request_filename){
                        rewrite ^(.+?\.php)/(.+)$ $1?$2 last;
                }
      include fastcgi.conf ;
      fastcgi_connect_timeout 300s;
      fastcgi_send_timeout 300s;
      fastcgi_read_timeout 300s;
    }

    location ~ /myusepath/.*$ {
          root /usr/local/nginx/html/workspace/ThinkPHP/;
            }
 
   location /static {
        alias /home/ops/log_analytics/web/web_env/cdn_overview/cdn_overview/static/; # STATIC_ROOT
        expires 30d;
    }

    location / { # STATIC_URL
        #proxy_pass http://127.0.0.1:8002;
        #proxy_read_timeout 600s;
        uwsgi_pass   unix:///tmp/uwsgi.sock;
        uwsgi_read_timeout 600s;
        include        uwsgi_params;
    }
}

抱歉!评论已关闭.