Windows2012+PHP7+NGINX1.9 搭建PHP環境

準備工作

修改php配置

  • 找到php.ini-development文件,修改爲php.ini,保存後打開:
  • 找到extension_dir去掉註釋,並把後邊的路徑改爲ext文件的實際路徑,如c:/php7/ext
  • 找到extension=php_mysqli.dll去掉註釋

啓動php

php-cgi.ext -b 127.0.0.1:9000

配置nginx

location / {
		root           C:\Web\bbs;
		index  index.html index.htm index.php;
	}
	#訪問前臺
        location ~ \.php$ {
		
            #rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
            #rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
            #rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
            #rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;
            #rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;
	    root           C:\Web\bbs;
	    fastcgi_pass   127.0.0.1:9000;
	    fastcgi_index  index.php;
	    fastcgi_param  SCRIPT_FILENAME  C:\Web\bbs$fastcgi_script_name;
	    include        fastcgi_params;
	}

  • php終端的解決方式:http://www.zuimoban.com/php/php/11504.html



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