location / { root html; index index.html index.htm; }并修改为
location / { root D:/dev_station/www/; # 站点根目录 index index.html index.htm; # 指定默认首页 autoindex on; # 若index项未配置,显示根目录下的文件列表 }
doc_root = "D:/dev_station/www" extension_dir = "D:/dev_station/env/php-5.3.26-Win32-VC9-x86/ext" date.timezone = Asia/Chongqing enable_dl = On cgi.force_redirect = 0 cgi.fix_pathinfo=1 fastcgi.impersonate = 1 cgi.rfc2616_headers = 1 extension=php_curl.dll extension=php_gd2.dll extension=php_mbstring.dll extension=php_mysql.dll extension=php_openssl.dll extension=php_sockets.dll extension=php_pdo_mysql.dll extension=php_sockets.dll
(3)打开 Nginx 根目录下 conf/nginx.conf,找到以下配置项并打开注释(大概65行),
location ~ \.php$ { root D:/dev-station/www/; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; }同时,在index中加入index.php,如下
location / { root D:/dev_station/www/; # 站点根目录 index index.html index.htm index.php; # 指定默认首页 autoindex on; # 若index项未配置,显示根目录下的文件列表 }
D:/dev_station/env/php-5.3.26-Win32-VC9-x86/php-cgi.exe -b 127.0.0.1:9000 -c D:/dev_station/env/php-5.3.26-Win32-VC9-x86/php.ini这个窗口不要关哦。
nginx.exe -s reload如果 Nginx.exe 未启动,输入
nginx.exe
<?php phpinfo(); ?>
extension=php_redis.dll
redis-server.exe redis.conf启动 Redis 服务,如图
nginx.exe -s reload重启nginx;
redis-cli.exe set test 123 显示:OK redis-cli.exe get test 显示:"123"
<?php // 确保启用了php-redis扩展,并且服务器端处于运行状态 $redis = new Redis(); // 进行连接 $redis->connect('127.0.0.1', 6379); // 使用 redis 设置 value $redis->set('key1', 'hello php and redis'); $redis->set('key2', time()); // 使用 redis 获取 value echo "key1:" . $redis->get('key1') ."<br />key2:" . $redis->get('key2'); ?>