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

  • Post author:
  • Post category:java


昨天因为修改了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),问题解决



版权声明:本文为y_w_x_k原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。