• [Nginx]


    CodeIgniter的配置:

    worker_processes  1;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        fastcgi_connect_timeout 300s;
        fastcgi_send_timeout 300s;
        fastcgi_read_timeout 300s;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 8 128k;#8 128
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
        fastcgi_intercept_errors on;
        #gzip  on;
    
        server {
            listen       80;
            #server_name  localhost;
    
            location / {
                    root   html;
                    index  index.php index.html index.htm;
                    try_files $uri $uri/ /index.php?$uri&$args;
            }
    
            location ~ .php$ {
                    include        fastcgi_params;
                    root           html;
                    fastcgi_pass   127.0.0.1:9000;
                    fastcgi_index  index.php;
                    fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_param PATH_INFO $fastcgi_path_info;
                    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
            }
        }
    
    }

    ThinkPHP配置:

    worker_processes  1;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        fastcgi_connect_timeout 300s;
        fastcgi_send_timeout 300s;
        fastcgi_read_timeout 300s;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 8 128k;#8 128
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
        fastcgi_intercept_errors on;
        #gzip  on;
    
        server {
            listen       80;
            #server_name  localhost;
    
            location / {
                    root   html;
                    index  index.php index.html index.htm;
                    #try_files $uri $uri/ /index.php?$uri&$args;
                    if (!-e $request_filename) {
                            rewrite ^(.*)$ /index.php?s=$1 last;
                            break;
                    }
            }
    
            location ~ .php$ {
                    #include        fastcgi_params;
                    include        fastcgi.conf;
                    root           html;
                    fastcgi_pass   127.0.0.1:9000;
                    fastcgi_index  index.php;
                    fastcgi_split_path_info  ^(.+.php)(/.*)$;
                    fastcgi_param  PATH_INFO $fastcgi_path_info;
            }
        }
    
    }

    Laravel配置:

    worker_processes  1;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        fastcgi_connect_timeout 300s;
        fastcgi_send_timeout 300s;
        fastcgi_read_timeout 300s;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 8 128k;#8 128
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
        fastcgi_intercept_errors on;
        #gzip  on;
    
            server {
                    listen 80;
                    #server_name localhost;
                    root /usr/local/nginx/html/public;
                    index index.html index.php;
    
                    location / {
                            try_files $uri $uri/ /index.php$is_args$query_string;
                    }
    
                    location ~ .php$ {
                            try_files $uri =404;
                            fastcgi_pass 127.0.0.1:9000;
                            fastcgi_index index.php;
                            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                            include fastcgi_params;
                    }
            }
    }

    前提是要启动PHP的FPM(默认端口为9000):

    /usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf
  • 相关阅读:
    第九篇装饰器基本原理
    第八篇迭代器协议和生产器
    python第六篇文件处理类型
    Python开发【第十篇】:模块
    习题练习
    2.2.6 集合
    第七篇 python基础之函数,递归,内置函数
    Python开发【第五篇】:Python基础之杂货铺
    Python开发【第四篇】:Python基础之函数
    详解CSS position属性
  • 原文地址:https://www.cnblogs.com/HD/p/5646483.html
Copyright © 2020-2023  润新知