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,看到这个页面,就代表已经安装成功:

80b9103ad51e

然后,自己尝试搭建第一个网页:

80b9103ad51e

1、简单描述下web 服务器、PHP、数据库、浏览器是如何实现动态网站的?

要了解动态网站,首先我们得知道一个用户获取静态网页的过程:

80b9103ad51e

首先用户在浏览器输入URL后,通过DNS来获取IP地址以找到相对应服务器。

服务器根据用户的需求,即URL地址上所表达的东西,返回给浏览器一个静态的HTML文件。

最后浏览器对该HTML文件进行渲染展现给用户。

如果网页是一成不变的还好,但是涉及到表单提交时,静态网站就远不能满足用户的需求了:

80b9103ad51e

在静态网页,用户表单填写无法与服务器进行交互,只能将数据填写完成之后,以邮件发送的形式将数据提交,且无法检查自己填写的信息,这么麻烦的操作催生了动态网页的形成。

80b9103ad51e

首先用户按照静态页面的方式获取了一个页面;

当用户在该静态页面上发送请求时,向服务器提交了一个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进行渲染,将饥人谷官网呈现给用户。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
小皮PHP环境配置教程如下: 1. 首先,下载并安装phpStudy。phpStudy是一个集成了Apache、PHP、MySQL和phpMyAdmin等工具的PHP调试环境程序集成包。安装过程非常简单,无需进行额外的配置即可使用。 2. 安装完成后,打开phpStudy面板。你可以在面板中找到各种功能和配置选项。 3. 在phpStudy面板中,找到“程序类型”设置,确保PHP选项被勾选上[2]。这样才能正常运行PHP程序。 4. 如果你只需要运行静态网页,不需要连接数据库或使用PHP,可以启动Nginx。注意,一键启动选项中的WNMP指的是Windows下的Nginx Mysql PHP开发环境。通过启动Nginx,你可以轻松运行静态网页。 5. 如果你需要连接数据库或使用PHP,你可以在phpStudy面板中设置MySQL数据库和phpMyAdmin工具。这样你就可以进行数据库操作和PHP开发。 综上所述,使用phpStudy可以方便地配置和使用PHP开发环境。根据你的需求,你可以启动Apache或Nginx,并配置MySQL数据库和phpMyAdmin工具。这样就可以开始进行PHP开发了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [PHPstudy小皮面板使用教程及详细解释](https://download.csdn.net/download/m0_64662164/85969756)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [利用phpstudy(小皮面板)配置本地PHP开发环境的记录](https://blog.csdn.net/wenhao_ir/article/details/126170178)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值