一、windows10
二、nginx安装与配置
nginx news开源网站下载稳定版本
1.nginx下载完成解压,即安装成功
2.进入安装目录,双击nginx.exe,启动nginx服务器
3.浏览器中打开http://localhost,出现nginx欢迎页面即为成功
三、安装配置php
1、进入PHP官网下载最新稳定版本,windows64位,非线程安全版本(nts版)
2.指定文件夹解压
3.根据安装目录配置php环境变量
4.打开cmd 输入php -v,可正常查看php版本信息即为安装成功!
5.php目录下的php.ini-development复制一份,重命名为php.ini,作为php的配置文件
(1)配置扩展目录:将; extension_dir = “ext”修改为extension_dir = "D:/Software/Php72/ext“
(2)开启常用扩展: mbstring、 pdo_mysql、mysqli
(3)修改当前时区: date.timezone = Asia/Shanghai
(4)配置cgi部分:cgi.fix_pathinfo=1去掉前面的分号
四、php与nginx整合(cgi)
1.进入conf文件夹,备份nginx.conf文件
2.修改nginx.conf
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 8080; server_name lst.com; access_log D:/PHP/Nginx/logs/access/lst.com.log; error_log D:/PHP/Nginx/logs/error/lst.com.log; set $ROOT_PATH D:/PHP/Sites/lst/www; location / { root $ROOT_PATH; index index.php index.html index.htm; } location ~ \.php$ { root $ROOT_PATH; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } } }
3.编辑index.php文件
<?php
echo phpinfo();
4.测试整合情况
(1)启动nginx服务器
(2)cmd中输入php命令:php-cgi.exe -b 127.0.0.1:9000 -c php.ini
(3)浏览器中输入http://127.0.0.1:8080(nginx中的配置网址)
出现以上画面,即为配置成功!
五、nginx配置统一管理
(1)nginx.conf改为
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; include D:/PHP/Nginx/confs/*.conf; }
(2)新建文件夹D:/PHP/Nginx/confs
(3)在新建目录中新建conf文件,例lst.com.conf,包含如下内容
server { listen 8080; server_name lst.com; access_log D:/PHP/Nginx/logs/access/lst.com.log; error_log D:/PHP/Nginx/logs/error/lst.com.log; set $ROOT_PATH D:/PHP/Sites/lst/www; location / { root $ROOT_PATH; index index.php index.html index.htm; } location ~ \.php$ { root $ROOT_PATH; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } }
(4)nginx正常启动,网页成功显示,即ok
(5)此后新增网站只在新目录中,创建对应的网站配置即可!
六、MySQL
MySQL的安装配置见另一帖!
quit();
标签:index,PHP,重置,重装系统,wnmp,nginx,lst,php,fastcgi From: https://www.cnblogs.com/lst-315/p/18253013