wnmp的php会自动挂掉,初探wnmp php
wnmp是windows下,Nginx、MySQL、PHP的环境集成包。新手用该集成包学习PHP,搭建自己的本地服务器十分便利。原理性的东西我还需要进一步学习,现在先简单看一下如何完成初始的环境构建。
首先进行本地服务器地址路径设置:
打开安装目录下的conf文件,在其中找到nginx.conf。初始配置文件如下:
worker_processes 1;
error_log logs/error.log;
pid logs/nginx.pid;
events {
# Max value 16384
worker_connections 8192;
# Accept multiple connections
multi_accept on;
}
# Settings that affect all server blocks
http {
include php_processes.conf;
include mime.types;
default_type application/octet-stream;
access_log logs/access.log;
sendfile on;
keepalive_timeout 65;
ssl_session_timeout 10m;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1 SSLv3;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!AECDH:!MD5:!DSS;
ssl_prefer_server_ciphers on;
gzip on;
# http server
# Begin HTTP Server
server {
listen 80; # IPv4
server_name localhost;
## Parametrization using hostname of access and log filenames.
access_log logs/localhost_access.log;
error_log logs/localhost_error.log;
## Root and index files.
root html;
index index.php index.html index.htm;
## If no favicon exists return a 204 (no content error).
location = /favicon.ico {
try_files $uri =204;
log_not_found off;
access_log off;
}
## Don't log robots.txt requests.
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
## Try the requested URI as files before handling it to PHP.
location / {
## Regular PHP processing.
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass php_processes;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
## Static files
location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf)$ {
expires max;
log_not_found off;
## No need to bleed constant updates. Send the all shebang in one
## fell swoop.
tcp_nodelay off;
## Set the OS file cache.
open_file_cache max=1000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
}
## Keep a tab on the 'big' static files.
location ~* ^.+\.(?:ogg|pdf|pptx?)$ {
expires 30d;
## No need to bleed constant updates. Send the all shebang in one
## fell swoop.
tcp_nodelay off;
}
} # / location
}
# End HTTP Server
# Begin HTTPS Server
server {
listen 443 http2 ssl;
server_name localhost;
ssl_certificate cert.pem;
ssl_certificate_key key.pem;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
## Parametrization using hostname of access and log filenames.
access_log logs/localhost_access.log;
error_log logs/localhost_error.log;
## Root and index files.
root html;
index index.php index.html index.htm;
## If no favicon exists return a 204 (no content error).
location = /favicon.ico {
try_files $uri =204;
log_not_found off;
access_log off;
}
## Don't log robots.txt requests.
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
## Try the requested URI as files before handling it to PHP.
location / {
## Regular PHP processing.
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass php_processes;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
## Static files are served directly.
location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf)$ {
expires max;
log_not_found off;
## No need to bleed constant updates. Send the all shebang in one
## fell swoop.
tcp_nodelay off;
## Set the OS file cache.
open_file_cache max=1000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
}
## Keep a tab on the 'big' static files.
location ~* ^.+\.(?:ogg|pdf|pptx?)$ {
expires 30d;
## No need to bleed constant updates. Send the all shebang in one
## fell swoop.
tcp_nodelay off;
}
} # / location
} # End HTTPS Server
}
改变http和https中的root下的路径为你所需要搭建本地服务器的路径,默认为html即可,其它内容还得继续研究,先跑起来再说~
此时,打开wnmp,start all之后,在浏览器输入localhost,看到这个页面,就代表已经安装成功:
然后,自己尝试搭建第一个网页:
1、简单描述下web 服务器、PHP、数据库、浏览器是如何实现动态网站的?
要了解动态网站,首先我们得知道一个用户获取静态网页的过程:
首先用户在浏览器输入URL后,通过DNS来获取IP地址以找到相对应服务器。
服务器根据用户的需求,即URL地址上所表达的东西,返回给浏览器一个静态的HTML文件。
最后浏览器对该HTML文件进行渲染展现给用户。
如果网页是一成不变的还好,但是涉及到表单提交时,静态网站就远不能满足用户的需求了:
在静态网页,用户表单填写无法与服务器进行交互,只能将数据填写完成之后,以邮件发送的形式将数据提交,且无法检查自己填写的信息,这么麻烦的操作催生了动态网页的形成。
首先用户按照静态页面的方式获取了一个页面;
当用户在该静态页面上发送请求时,向服务器提交了一个php脚本的地址;
服务器通过php对用户的需求进行处理:可以发送邮件,也可以通过数据库(php一般对应的MySQL)增删改查来存储数据;
服务器将运行过php转换为html文件,并返还给浏览器;
浏览器对html文件进行渲染,呈现在用户面前。
2、常见的web服务器有哪些?
最常见的WEB服务器是:Apache、Nginx、IIS;
此外还有:Tomcat和Zeus。
3、打开浏览器,在地址栏输入 http://jirengu.com 页面展现了饥人谷官网的信息,整个过程发生了什么?(饥人谷官网后台语言 php,web服务器 nginx,数据库 mysql)
互联网通过DNS将URL翻译成IP地址(如果先前访问过该网站,通过浏览器->操作系统->路由器->运营商->根,层层寻找DNS缓存,一定会得到!);
若用户以前登录过饥人谷官网,随着URL地址传过来的还有一个cookie。
此饥人谷的服务器nginx得到响应,根据用户的需求,通过PHP进行处理,如果涉及到用户登录以及数据请求或提交,还将与数据库MySQL进行交互,服务器将返回一个静态的html文档。
通过TCP/IP协议三次握手,确定网络正常,将静态html文档送至客户端(浏览器)。
浏览器对html进行渲染,将饥人谷官网呈现给用户。
wnmp的php会自动挂掉,初探wnmp php相关推荐
- SAP SD微观研究之销售发票自动生成初探
SAP SD微观研究之销售发票自动生成初探 SAP项目实践中,销售业务里的开票(BILLING)功能,可以根据业务实际设置成自动生成.笔者经历过的项目里,大致有2种不同的实现方式. 一种方式是,将事务 ...
- Hbase2.4.1集群安装:HMaster自动挂掉问题终于解决了
文章目录 HBase集群安装 一.实验目的及要求 二.实验设备 三.实验内容与步骤 四.实验结果 (1)准备工作:启动hdfs,zookeeper (2)解压hbase包到指定目录 修改名字为hbas ...
- SpringBoot 自动配置初探
SpringBoot 自动配置初探 @EnableAutoConfiguration @Import(AutoConfigurationImportSelector.class) selectImpo ...
- 启动kafka过一会进程自动挂掉问题原因
这是因为kafka logs目录下的meta.properties文件中的broker.id与server.properties中的broker.id不一致所导致,只需把两者改为一致启动kafka后就 ...
- 记SpringBoot项目运行2h自动挂掉的坑
记SpringBoot项目运行2h自动挂掉的坑 背景 过程 解决方案一 解决方案二 总结 背景 以前多使用tomcat容器部署war项目或者使用jenkins直接部署,没有亲自体验过部署jar.所以, ...
- mysql 挂掉 无法启动_mysql-配置 - MySQL错误,时不时自动挂掉,无法启动
问 题 mysql时不时挂掉,无法启动,请问是什么原因啊? my.cnf配置: [client] port = 3306 socket = /tmp/mysql.sock [mysqld] port ...
- SpringBoot -> 自动装配初探,debug=ture判断配置类是否生效
文章目录 第一个注解:@SpringBootApplication 点进去有一堆注解: 1.这4个是元注解: 2.@SpringBootConfiguration @EnableAutoConfigu ...
- spark history server内存不足服务自动挂掉
版本:Spark 1.5.2 built for Hadoop 2.4.0 今天spark的history server自己挂掉了,查看日志: 16/05/13 14:12:30 WARN DFSCl ...
- 为什么spring cloud服务启动之后回到命令行会自动挂掉
我们的spring cloud微服务一般是打成jar包发布的,Linux下启动jar包和windows下一样,都是java -jar 包名,实际操作过的小伙伴可能会遇到这种情况:用java -jar启 ...
- filebeat 莫名其妙自动挂掉
filebeat莫名其妙自动关闭 前言:前一段时间搭建改造了一套elk(filebeat+logstash+ksql+es+kibana)日志系统,最开始的时候是filebeat直接发送给es,后来需 ...
最新文章
- CMA内存管理子系统
- ubuntu18.04安装openresty
- java神剑30变_改动对比 - 神剑养成(一) (MengSword1) - MC百科|最大的Minecraft中文MOD百科...
- 暗黑破坏神(背包)(内部模拟)
- 关键词是用分号还是逗号隔开_逗号、顿号、分号、冒号、破折号的用法
- android模拟点击滑动,模拟Android的view点击和滑动监听
- awd赛题的flag是什么意思_写在新年伊始——由新年Flag所想到的
- 程序员从入门到放弃,书籍推荐
- 大数据工程师简历_大数据工程师简历3份
- 关于brvah的setEmptyView功能无法显示问题
- Spring实战——UrlResource
- 工程力学和计算机专业,工程力学本科专业介绍
- php asic,ASIC和FPGA的优势与劣势
- 用matlab编写驻波图,用驻波法测声速的Matlab模拟
- win10Ie重置.html默认应用设置,win10系统IE浏览器设置为默认浏览器的操作方法
- 两场面试,一次心灵洗礼
- Android:scheme总结(包含data其他部分)
- 海盗分金-动态规划实现
- 记录一次Anaconda安装Spyder失败及解决方法
- windows装机必备:文件查找神器Everything + Wox