nginx配置相关

一、autoindex on; 能解决无端端的403问题。

二、NGINX配置超时时间

1、啥时候用到

    用来设置请求资源和服务器返回的时间,保证一个请求占用固定时间,超出后报504超时!这样可以保证一个请求占用过长时间。

2、主要参数

    使用nginx服务器如果遇到timeou情况时可以如下设置参数,使用fastcgi:

    fastcgi_connect_timeout 75;  链接

    fastcgi_read_timeout 600;   读取

    fastcgi_send_timeout 600;   发请求

    这两个选项.
    fastcgi_read_timeout是指fastcgi进程向nginx进程发送response的整个过程的超时时间
    fastcgi_send_timeout是指nginx进程向fastcgi进程发送request的整个过程的超时时间

    这两个选项默认都是秒(s),可以手动指定为分钟(m),小时(h)等

三、网站根域名默认指向www配置

 

 if ($http_host !~ "^www.xxx.com$") {

                       rewrite  ^(.*)    http://www.xxx.com$1 permanent;

                 }

 

根据get参数动态指向不同目录

server {
        listen       80;
        server_name  mb-dev.api.11yuehui.com;
        index index.php index.html;
        autoindex on;
        include enable-php.conf;

        set $branche "branche";

        if ($query_string ~ "_APPVERSION=(.*)") {
            set  $branche  $1;
        }

        root /opt/htdocs/haluo/$branche/public;

        include thinkphp.conf;
        access_log  /home/wwwlogs/mb_access.log;
}

//thinkphp.conf

location / {
        
        
    if (!-e $request_filename) {
        rewrite ^(.*)$ index.php?s=/$1 last;
        break;
    }    
} 

  

 2018-08-14

php的运行监听不要用socket方式,要用端口的方式,不然会报以下错误

PHP message: PHP Fatal error:  Too many concurrent users, try again in 1 seconds.

  

posted @ 2014-10-01 00:07  zenghansen  阅读(285)  评论(0编辑  收藏  举报