永久链接设置 无法开启地址重写功能 "重写功能检测失败, 请检查你的服务器设置" #526

Closed
cuteribs opened this Issue Jan 11, 2017 · 1 comment

Projects

None yet

2 participants

@cuteribs

环境: 内核 debian 4.9 rc8 x64, docker容器 alpine 3.4, nginx 1.10.1, php 5.6.29, sqlite 3.13.0

nginx.conf 内容:

# run nginx in foreground
daemon off;

error_log /data/logs/nginx/nginx-error.log error;
pid /var/run/nginx.pid;
worker_processes	auto;

events {
	worker_connections	1024;
}

http {
	sendfile		on;
	include			/etc/nginx/mime.types;
	include			/etc/nginx/fastcgi.conf;
	default_type	application/octet-stream;
	tcp_nopush		on;
	client_body_temp_path /tmp/nginx/body 1 2;
	fastcgi_temp_path /tmp/nginx/fastcgi_temp 1 2;
	
	client_max_body_size 2G;
	
	server {
		listen		80;		
		root		/data/www;
		index		index.php index.html index.htm;		
 
		location = /robots.txt {
			allow all;
			log_not_found off;
			access_log off;
		}
		
		# deny dot-files
		location ~ /\. { 
			deny all;
			access_log off;
			log_not_found off; 
		}


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

		location / {			
			if (-f $request_filename/index.html) {
		   		rewrite (.*) $1/index.html break;
			}
		
			if (-f $request_filename/index.php)	{
		   		rewrite (.*) $1/index.php;
			}

			if (!-f $request_filename) {
				rewrite (.*) /index.php;
			}
		}

		location ~ .*\.php(\/.*)*$ {			
			include fastcgi.conf;
			fastcgi_pass 127.0.0.1:9000;
			fastcgi_index index.php;
			include fastcgi_params;

			set $path_info "";
			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;
		}
	}	
}
@joyqi
Member
joyqi commented Jan 12, 2017

不必管它,你可以强制启用,这个检测受服务器环境影响会有很多限制

@joyqi joyqi closed this Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment