#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 {incl...
 
                
#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  logs/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    gzip  on;
    server {
        listen       80;
        server_name  localhost;
       root   html;
        index  index.php index.html index.htm;
        #access_log  logs/host.access.log  main;
        location / {
        if (!-e $request_filename){
                    #一级目录
               rewrite ^/(.*)$ /index.php/$1 last;
             break;
                 }
           }
      
      location /tk/ {
          if (!-e $request_filename){
                    #二级目录
               rewrite ^/tk/(.*)$ /index.php/$1 last;
             break;
                 }
           }
        #error_page  404              /404.html;
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
          }
    location ~ \.php {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            include fastcgi_params;
        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;
         }
      location /nginx_status
        {
            stub_status on;
            access_log off;
        }
      location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires 30d;
        }
      location ~ .*\.(js|css)?$
        {
            expires 12h;
        }
      location ~ /\.
        {
            deny all;
        }
    }
   include /usr/local/nginx/vhost/*.conf;
}
				 沃梦达教程
				
			本文标题为:thinkphp nginx配置
 
				
         
 
            
        基础教程推荐
             猜你喜欢
        
	     - PHP基于反射机制实现自动依赖注入的方法详解 2022-10-02
- php如何获取当前日期和星期 2024-12-06
- php+mysql开发的最简单在线题库(在线做题系统)完整案例 2023-01-04
- Laravel 解决composer相关操作提示php相关异常的问题 2023-03-08
- php生成短网址/短链接原理和用法实例分析 2023-04-20
- PHP laravel使用自定义邮件类实现发送邮件 2023-07-03
- PHP字符串函数系列之nl2br(),在字符串中的每个新行 (\n) 之前插入 HTML 换行符br 2024-03-28
- Laravel修改验证提示信息为中文的示例 2023-03-08
- php去除deprecated的实例方法 2022-09-02
- PHP采用get获取url汉字出现乱码的解决方法 2024-03-28
 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
						 
						 
						 
						 
						 
				 
				 
				 
				