Record a test available nginx+tp5 configuration file




#user  nobody;
worker_processes  1;


#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;


#pid        logs/nginx.pid;




events {
    worker_connections  1024;
}




http {
    include       mime.types;
    default_type  application/octet-stream;


    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';


    access_log  /var/log/nginx/access.log  ;


    sendfile        on;
    #tcp_nopush     on;


    #keepalive_timeout  0;
    keepalive_timeout  65;




    error_log /var/log/nginx/nginx-error.log ;


    #gzip  on;


    server {
        listen       80;
        #listen       443 ssl;
        server_name  youservername;


        #ssl_certificate      /usr/local/nginx/conf/cert/214404539700702.pem;
        #ssl_certificate_key  /usr/local/nginx/conf/cert/214404539700702.key;


        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;


        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
        
        


set        $root    /home/yourpath;


        


        location / {
            root  /home/yourpath;
            
            #try_files $uri $uri/ /index.php?$query_string;
            


            index    index.html index.php;
            if ( -f $request_filename) {
            break;
           }
           if ( !-e $request_filename) {
            rewrite ^(.*)$ /index.php/$1 last;
            break;
           }
            
        }

        location ~ .+\.php($|/) {
        root  /home/yourpath;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param    SCRIPT_FILENAME    $root$fastcgi_script_name;
        include        fastcgi_params;
       }


        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        
    }

}


Refer to http://www.thinkphp.cn/topic/40391.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325954752&siteId=291194637