网站伪静态app开发经费预算表

当前位置: 首页 > news >正文

网站伪静态,app开发经费预算表,吉祥物设计网站,建设一个网站费用1.用户常用关于web的信息 1.1.什么是www www是world wide web的缩写#xff0c;及万维网#xff0c;也就是全球信息广播的意思。 通常说的上网就是使用www来查询用户所需要的信息。 www可以结合文字、图形、影像以及声音等多媒体#xff0c;超链接的方式将信息以Internet…1.用户常用关于web的信息 1.1.什么是www www是world wide web的缩写及万维网也就是全球信息广播的意思。 通常说的上网就是使用www来查询用户所需要的信息。 www可以结合文字、图形、影像以及声音等多媒体超链接的方式将信息以Internet传递到世界各 处去。 当你连接www网站该网站会提供一些数据客户端要使用可以解析这些数据的软件来处理那就是浏览器。 1.2.网址 URIUniform Resource Identifier统一资源标识分为URL和URN。 URN:Uniform Resource Naming统一资源命名P2P下载使用的磁力链接是URN的一种实现。 URLUniform Resorce Locator统一资源定位符用于描述某服务器某特定资源位置 两者区别URL提供查找该事物的方法URN仅用于命名而不指定地址。 1.3.URL组成 URL组成机 scheme://user:passwordhost:port/path:params?query#frag 2.HTTP简介 2.1.什么是http HTTP协议 全称为Hyper Text Transfer Protocol超文本传输协议 简单来说http就是从服务器传输超文本html到本地浏览器的传输协议 HTTP协议工作于B/S架构上浏览器作为HTTP客户端通过URL向HTTP服务端即WEB服务端发送请 求RequestWeb服务端根据接收到的请求数据后向客户端发送响应信息Response。 https://developer.mozilla.org/zh-CN/docsWeb/ 2.2.http工作机制 2.2.1.web中常用的语言介绍 html语言 超文本标记语言 html head meta http-equivContent-Type contenttext/html;charsetutf-8 titleHTML语言/title /head body h1 stylecolor:red欢迎/h1 pa hrefhttp://www.baidu.com百度/a你好/p /body /html css 层叠样式表 表述网站的风格 html head meta http-equivContent-Type contenttext/htm1;charsetutf-8 link relstylesheet typetext/css hrefmystyle.css / /head body h1这是标题/h1 p红色代表喜庆该段为红色/p p classex蓝色宁静而深邃的色彩承载着丰富的寓意和象征意义。该段落中的文本是蓝色的。/p /body /html css文件 –body {color: #e76666}h1 {color: #65c2b1}p.ex {color: #6e6ea2} js实现html和css实现不了的功能比如动画效果 !DOCTYPE html html head meta http-equivContent-Type contenttext/html;charsetutf-8 /head body h2我的第一个JavaScript/h2 button typebutton onclickdocument.getElementById(demo).innerHTML Date() 点击这里来显示日期和时间 /button p iddemo/p /body /html 2.2.2.mineMultipurpose Internet Mail Extensions多用途因特网邮件扩展 它设计的最初目的是为了在发送电子邮件时附加多媒体数据让邮件客户程序能根据其类型进行处 理 为了支持多媒体数据类型HTTP协议中就使用了附加在文档之前的MIME数据类型信息来标识数据 类型。 其主要功能是让服务器将它们发送的多媒体数据的类型告诉浏览器 服务器将MIME标志符放入传送的数据中来告诉浏览器使用哪种插件读取相关文件 MIME类型存在于HTTP响应报文的响应头部信息里它是一种文本标记 MIME格式 type/subtype 文件类型后缀html txt jpg png… … 2.3.http访问请求完整过程 1.建立连接 TCP的3次握手建立链接向服务器发送http请求服务器拒绝或允许 2.接受请求 接受客户端请求报文对某个资源的一次请求过程web响应访问模型 a.单进程I/O模型启动一个进程处理用户请求而且一次只处理一个多个请求被串行响应 b.多进程I/O模型:并行启动多个进程,每个进程响应一个连接请求 c.复用I/O结构:启动一个进程同时响应N个连接请求 d.复用的多进程I/O模型:启动M个进程每个进程响应N个连接请求同时接收MN个请求 3.处理请求 服务器对请求报文进行解析并获取请求的资源及请求方法等相关信息根据方法资源首部和可选 的主体部分对请求进行处理常用请求Method: GET、POST、HEAD、PUT、DELETE、TRACE、OPTIONS 4.访问资源: 服务器获取请求报文中请求的资源web服务器即存放了web资源的服务器负责向请求者提供对方请求 的静态资源或动态运行后生成的资源 5.构建响应报文: 一旦Web服务器识别除了资源就执行请求方法中描述的动作并返回响应报文。响应报文中包含有响 应状态码、响应首部如果生成了响应主体的话还包括响应主体 响应实体:如果事务处理产生了响应主体就将内容放在响应报文中回送过去。 响应报文中通常包括: 描述了响应主体MIME类型的Content-Type首部 描述了响应主体长度的Content-Length 实际报文的主体内容 2)URL重定向:web服务构建的响应并非客户端请求的资源而是资源另外一个访问路径 3)MIME类型:Web服务器要负责确定响应主体的MIME类型。多种配置服务器的方法可将MIME类型 与资源管理起来 6.发送响应报文: Web服务器通过连接发送数据时也会面临与接收数据一样的问题。服务器可能有很多条到各个客户端的 连接有些是空闲的有些在向服务器发送数据还有一些在向客户端回送响应数据。服务器要记录连 接的状态还要特别注意对持久连接的处理。对非持久连接而言服务器应该在发送了整条报文之后 关闭自己这一端的连接。对持久连接来说连接可能仍保持打开状态在这种情况下服务器要正确地 计算Content-Length首部不然客户端就无法知道响应什么时候结束 2.4.http协议报文头部结构 2.4.1.请求报文 请求报文由三部分组成开始行、首部行、实体主体 开始行请求方法 url 版本 CRLF 首部行通常用键值表示 空格 实体主题数据一般在post动作中可以提看到 开始行中的请求方法 2.4.2.响应报文 响应报文由三部分组成即开始行、首部行、实体主体 开始行http版本 状态码 短语 CRLF 首部行通常用键值表示 空格 实体主题数据即获取内容 2.5.状态代码 状态码由三位数字组成第一个数字定义了响应的类别且有五种可能取值 常见状态代码、状态描述的说明如下 3.web服务的配置详解 3.1.web服务的常用种类 Apache  Nginx  openresty  大厂自研 curl -I 163.com curl -I baidu.com 3.2.Nginx的安装 开源版本的Nginx官网nginx [rootlocalhost 桌面]# dnf install nginx -y [rootlocalhost ~]# systemctl enable –now nginx //开启服务 Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service. 查看端口 [rootlocalhost 桌面]# netstat -antlupe | grep nginx tcp 0 0 0.0.0.0:80 0.0.0.0: LISTEN 0 37696 3402/nginx: master
tcp6 0 0 :::80 :::* LISTEN 0 37697 3402/nginx: master
默认配置文件 [rootlocalhost 桌面]# cd /etc/nginx 默认发布目录 [rootlocalhost nginx]# cd /usr/share/nginx/html/ 修改默认发布目录 [rootlocalhost nginx]# mkdir /nginx/virtual/aaa.org/{news,bbs}/html -p [rootlocalhost nginx]# echo bbs.aaa.org /nginx/virtual/aaa.org/bbs/html/index.html [rootlocalhost nginx]# echo news.aaa.org /nginx/virtual/aaa.org/news/html/index.html [rootlocalhost nginx]# vim nginx.conf root /nginx/html; index aaa.html; //默认发布文件 3.4nginx配置文件内容详解 nginx全局配置 user nginx; #nginx程序运行用户 worker_processes auto; #开启work进程数量 error_log /var/log/nginx/error.log notice; #错误日志 pid       /var/run/nginx.pid; #pid文件 events {worker_connections 1024; #可接受最大连接数 } http模块配置 http {include       /etc/nginx/mime.types; #可解析的静态资源类型default_type application/octet-stream; #用来配置Nginx响应前端请求默认的MIME类 型log_format main \(remote_addr - \)remote_user [\(time_local] \)request \(status \)body_bytes_sent \(http_referer \)http_user_agent \(http_x_forwarded_for;access_log /var/log/nginx/access.log main; #访问日志sendfile       on; # Nginx服务器是否使用sendfile()传输文件#tcp_nopush     on; # 当包累计到一定大小后就发送默认0.2s一次keepalive_timeout 65; # 长连接超时时间子配置文件#gzip on; #可以使网站的css、js 、xml、html 等静态资源在传输时 进行压缩include /etc/nginx/conf.d/*.conf; #指定子配置文件 } 子配置文件 /etc/nginx/conf.d/default.conf server {listen       80; #监听端口server_name localhost; #服务器的名字location / {root   /usr/share/nginx/html; #默认发布目录index index.html index.htm; #默认发布文件}#error_page 404             /404.html;# redirect server error pages to the static page /50x.html#error_page   500 502 503 504 /50x.html; #访问出错呈现错误页面location /50x.html {root   /usr/share/nginx/html; } } 3.5.Nginx配置 3.5.1基于IP的虚拟主机 [rootlocalhost 桌面]# mkdir /nginx/virtual/aaa.org/{news,bbs}/html -p [rootlocalhost 桌面]# ls -ld /nginx/virtual/aaa.org/{news,bbs}/html drwxr-xr-x 2 root root 6 12月 10 16:13 /nginx/virtual/aaa.org/bbs/html drwxr-xr-x 2 root root 6 12月 10 16:13 /nginx/virtual/aaa.org/news/html [rootlocalhost 桌面]# echo bbs.aaa.org /nginx/virtual/aaa.org/bbs/html/index.html [rootlocalhost 桌面]# echo news.aaa.org /nginx/virtual/aaa.org/news/html/index.html[rootlocalhost 桌面]# ip a a 172.25.254.101/24 dev ens160 [rootlocalhost 桌面]# ip a a 172.25.254.102/24 dev ens160[rootlocalhost conf.d]# vim vhosts.conf [rootlocalhost conf.d]# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [rootlocalhost conf.d]# nginx -s reload [rootlocalhost conf.d]# cat vhosts.conf server{listen 172.25.254.101:80;root /nginx/virtual/aaa.org/bbs/html;index index.html; } server {listen 172.25.254.102:80;root /nginx/virtual/aaa.org/news/html;index index.html; }[rootlocalhost conf.d]# curl news.aaa.org news.aaa.org [rootlocalhost conf.d]# curl bbs.aaa.org news.aaa.org 3.5.2基于域名的虚拟主机 [rootlocalhost conf.d]# vim vhosts.conf [rootlocalhost conf.d]# cat vhosts.conf server{listen 80;server_name bbs.aaa.org;root /nginx/virtual/aaa.org/bbs/html;index index.html; } server {listen 80;server_name news.aaa.org;root /nginx/virtual/aaa.org/news/html;index index.html; } [rootlocalhost conf.d]# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [rootlocalhost conf.d]# nginx -s reloadLinux中做域名解析 [rootlocalhost conf.d]# vim /etc/hosts [rootlocalhost conf.d]# curl www.aaa.org aaa [rootlocalhost conf.d]# curl www.bbs.org ^[[A^C [rootlocalhost conf.d]# curl bbs.aaa.org bbs.aaa.org [rootlocalhost conf.d]# curl news.aaa.org news.aaa.org3.5.3基于认证的访问控制  基于ip的访问控制 rootlocalhost html]# mkdir admin [rootlocalhost html]# echo admin admin/index.html [rootlocalhost html]# curl 172.25.254.100/admin/ admin[rootlocalhost html]# vim /etc/nginx/nginx.conf [rootlocalhost html]# nginx -s reload [rootlocalhost html]# curl 172.25.254.100/admin/ admin 基于IP的访问控制 [rootlocalhost html]# dnf install httpd-tools -y [rootlocalhost html]# htpasswd -cm /etc/nginx/.htpasswd admin New password: Re-type new password: Adding password for user admin [rootlocalhost html]# cat /etc/nginx/.htpasswd admin:\)apr1\(wq41crUZ\)hLYd97P6s4ceABx4XWZpD.[rootlocalhost html]# vim /etc/nginx/nginx.conf [rootlocalhost html]# nginx -s reload [rootlocalhost html]# curl 172.25.254.100/admin/ -uadmin:aaa aaa 3.6.web服务器的数据加密https 3 3.6.1.https简介  HTTP协议以明文方式发送内容不提供任何方式的数据加密HTTP协议不适合传输一些敏感信息比如信用卡号、密码等为了解决HTTP协议的这一缺陷需要使用另一种协议安全套接字层超文本传输协议HTTPS。HTTPS全称Hyper Text Transfer Protocol over Secure Socket Layer 是以安全为目标的HTTP通道HTTPS并不是一个新协议而是HTTPSSLTLS原本HTTP先和TCP直接通信而加了SSL后就变成HTTP先和SSL通信再由SSL和TCP通信相当于SSL被嵌在了HTTP和TCP之间。 3.6.2.https握手流程 3.6.3.部署https 1.生成密钥 [rootlocalhost html]# openssl req -newkey rsa:2048 -nodes -sha256 -keyout /etc/nginx/certs/aaa.org.key -x509 -days 365 -out /etc/nginx/certs/aaa.org.crt [rootlocalhost 桌面]# mkdir /nginx/virtual/aaa.org/login/html -p [rootlocalhost 桌面]# echo login.aaa.org /nginx/virtual/aaa.org/login/html/index.html[rootlocalhost html]# cd /etc/nginx/certs/ [rootlocalhost certs]# ls aaa.org.crt aaa.org.key [rootlocalhost certs]# openssl x509 -in aaa.org.crt -text -noout [rootlocalhost certs]# cd /etc/nginx/conf.d/ [rootlocalhost conf.d]# vim https.confserver {listen 443;server_name login.aaa.org;root /nginx/virtual/aaa.org/login/html/;index index.htmlssl_certificate /etc/nginx/certs/aaa.org.crt;ssl_certificate_key /etc/nginx/certs/aaa.org.key;ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers         HIGH:!aNULL:!MD5; } ~ 3.7搭建动态网站 动态网站指网站内容可根据不同情况动态变更的网站一般情况下动态网站通过数据库进行架构。 动态网站除了要设计网页外还要通过数据库和编程序来使网站具有更多自动的和高级的功能。 动态网页使用网页脚本语言比如php、JSP等通过脚本将网站内容动态存储到数据库用户访 问网站是通过读取数据库来动态生成网页的方法 配置web服务器对php站点的支持 [rootlocalhost ~]# mkdir -p /nginx/html/index.php [rootlocalhost html]# cat index.php ?phpphpinfo(); ? 2.配置web服务器对php页面的发布 location ~ .php\( {fastcgi_pass php-fpm; # 对应前面在 php-fpm.conf 中定义的 upstream 名称fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME /nginx/html/\)fastcgi_script_name;include fastcgi_params;}