Windows + nginx+ PHP:报错:Windows + Apache + MySQL + PHP

首先,按照网上的攻略配安装好php,本人采用的是:Windows7搭建Wamp环境中的php环境搭建方法和Windows下的Nginx安装与配置(PHP),然后碰到的问题。。。。。

1.环境配置好了后,启动php项目,输入方式为:ip:port/index.php,但是报错:no input file specified 

此时的解决方法是:删除nginx根目录里的.user.ini文件

2.php项目域名/模块/控制器/方法报404

但是通过ip:port/index.php?m=块&c=控制器&a=方法方式却可以访问,此时,在确保项目没有问题的情况系下,可以推断原因应该是nginx的配置问题

1.在配置文件中增加重写:

 location / {
            
            index  index.php;
			try_files $uri $uri/ /index.php?$query_string;
			if (!-e $request_filename) {
  	    rewrite ^/(.*)$ /index.php/$1 last;
 	    break;
	  }

2.nginx.conf文件中配置为:

 location ~ \.php(.*)$ {
           fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }

感谢https://segmentfault.com/q/1010000008823783

你可能感兴趣的:(知识点,debug,nginx,php,报错)