We're sorry but xxxx doesn't work properly without JavaScript enabled不修改路由模式解決方案

昨天因爲修改了nginx.conf配置文件,原本可以運行的網站報錯了,請求接口出現:We're sorry but xxxx doesn't work properly without JavaScript enabled. Please enable it to continue錯誤;

後來探索了下發現是刪除了nginx.conf裏識別pathinfo模式的代碼,只要在/etc/nginx nginx.conf內補充代碼如下:

	location ~ \.php {
		root           /你的目錄路徑;
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_index  index.php;
		fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
		include        fastcgi_params;
		#pathinfo support
		set $real_script_name $fastcgi_script_name;
		set $path_info "";
		if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$"){
			set $real_script_name $1;
			set $path_info $2;
		}
		fastcgi_param SCRIPT_NAME $real_script_name;
		fastcgi_param PATH_INFO $path_info;
	}

重啓nginx (/usr/sbin/nginx -s reload),問題解決

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章