Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

第 10 章 CodeIgniter - Open source PHP web application framework

目錄

10.1. Nginx
10.2. PHP_CodeSniffer

homepage: http://www.codeigniter.com/

下載解壓後複製到 /usr/share/php/

	
$ chmod 755 -R /usr/share/php/CodeIgniter_2.0.0
$ ln -s /usr/share/php/CodeIgniter_2.0.0 /usr/share/php/CodeIgniter
$ ls /usr/share/php
CodeIgniter Smarty
	
	

rewrite

lighttpd 為例

	
url.rewrite = ( "^/(.+)" => "/index.php/$1"
	
	

10.1. Nginx

		
	location / {
        root   /www/mydomain.com/report.mydomain.com/htdocs;
        index  index.php index.html;

        if ($request_filename !~ (js|css|images|robots/.txt|index/.php) ) {
                rewrite ^/(.*)$ /index.php/$1 last;
                break;
        }

    }

    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
        access_log        off;
        expires           7d;
    }

    location ~ \.php$ {
        if ($request_filename !~ (index/.php) ) {
                return 404;
        }
    }

	location ~ /index.php/ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /www/mydomain.com/report.mydomain.com/htdocs/index.php;
        include        fastcgi_params;
    }
		
		
		
	location / {

        root  /www/www.example.com/public;
        index  index.php;

        # this serves static files that exist without running other rewrite tests
        if (-f $request_filename) {
            expires 30d;
            break;
        }

        # this sends all non-existing file or directory requests to index.php
        if (!-e $request_filename) {
                rewrite ^(.+)$ /index.php?$1 last;
        }
    }

    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
        access_log        off;
        expires           30d;
        root /www/www.example.com/public;
    }



    # pass the *.php scripts to php5-fpm listening on tcp port 9000 #
    location ~ \.php$ {
        root  /www/www.example.com/public;
        index  index.php;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;

        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SERVER_NAME $http_host;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_ignore_client_abort on;
    }

    ## Disable viewing .htaccess & .htpassword
    location ~ /\.ht {
        deny  all;
    }