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

构建一个网站需要什么手机百度搜索

构建一个网站需要什么,手机百度搜索,wordpress建公司网站,东莞松山湖网站建设1. web服务 1. WEB服务:网站服务,部署并启动了这个服务,你就可以搭建一个网站 2. WEB中间件: 等同于WEB服务 3. 中间件:范围更加广泛,指的负载均衡之后的服务 4. 数据库中间件:数据库缓存,消息对列 2. 极速上手指南 nginx官网: nginx documentation 2.1 配置yum源 vim /etc/…

1. web服务

1. WEB服务:网站服务,部署并启动了这个服务,你就可以搭建一个网站

2. WEB中间件: 等同于WEB服务

3. 中间件:范围更加广泛,指的负载均衡之后的服务

4. 数据库中间件:数据库缓存,消息对列

2. 极速上手指南

nginx官网: nginx documentation

2.1 配置yum源

vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

2.2 yum安装nginx

yum install -y nginx

2.3 检查安装

nginx -V

 2.4 目录结构

目录结构说明
/etc/nginx/nginx各种配置文件的目录
/etc/nginx/nginx.conf主配置文件
/etc/nginx/conf.d/子配置文件(网站)
/etc/nginx/conf.d/default.conf默认的子配置文件
/usr/sbin/nginxnginx的命令
/usr/share/nginx/html/nginx默认的站点目录,网站的根目录
/var/log/nginx/nginx日志:访问日志,错误日志,跳转日志

2.5 日常启动与管理

##创建自启动文件
systemctl  enable nginx
##启动服务
systemctl  start nginx
##查看端口
ss - lntup
##查看进程
ps -ef |grep nginx

 2.6 浏览器访问:http://10.0.0.8

2.7 命令行访问

curl  10.0.0.8
curl  -v 10.0.0.8

3. Nginx核心功能详解 

3.1 主配置文件详解(/etc/nginx/nginx.conf)

3.2 子配置文件(/etc/nginx/conf.d/default.conf)

如果删除首页文件,进行(不指定文件)访问会发生什么?

403文件首页不存在

 4 部署第1个网站

网站要求说明
域名cxk.oldboylinux.com
站点目录/app/code/cxk
代码来源cxk.zip

 4.1 配置文件

##子配置文件
vim /etc/nginx/conf.d/cxk.conf
server {listen       80;server_name  cxk.oldboylinux.cn;location / {root   /app/code/cxk;index  index.html;}
}
##检查语法
nginx -t
##热加载
systemctl  reload nginx

4.2 其他配置

##创建站点目录
mkdir -p /app/code/cxk
##解压代码
unzip cxk.zip
mv cxk /app/code/##配置linux和windows hosts解析
#win: C:\Windows\System32\drivers\etc\hosts
#windows下面win键+r 输入drivers 访问etc下的hosts
#linux: /etc/hosts
10.0.0.8 cxk.oldboylinux.cn

4.3 访问

5. Nginx处理用户请求流程

5.1 使用域名访问网站流程:

1. DNS解析:域名 ------->>IP地址

2. 连接80端口: tcp3次握手与网站的80端口建立连接

3. http请求:请求方法,URI,HOST等信息

4. nginx处理:

       4.1  http请求,http区域处理

       4.2 不同的server{} 区域(子配置文件)处理

               4.2.1 端口

               4.2.2 域名:用户请求的域名与子配置文件server_name进行匹配

               4.2.3 匹配成功,就让对应的子配置文件(server{})处理

               4.2.4 根据子配置文件的,root,location规则,index进行处理查找文件

               4.2.5 把找到的文件发回给用户

 5. http响应

 6. 客户收到文件内容,浏览器解析,进行展示

5.2 虚拟主机

5.2.1 概述与分类

虚拟主机的分类说明应用场景
基于域名的虚拟主机不同域名访问不同的站点生产环境最常用的
基于端口的虚拟主机不同端口访问不同的站点保护,设置特殊端口.1024以上 8888 18888
基于ip的虚拟主机不同ip访问不同的站点保护,用户只能通过某个ip连接进来

5.2.2 基于域名的虚拟主机

##创建子配置文件
vim /etc/nginx/conf.d/bird.conf
server {listen 80;server_name bird.oldboulinux.cn; ##站点目录location /{root /app/code/bird;index index.html;}}
测试不创建站点目录:
curl -H Host:bird.oldboylinux.cn  http://10.0.0.8

测试创建站点目录,但是没有首页文件
##创建站点目录
mkdir -p /app/code/bird/
##测试
curl -H Host:bird.oldboylinux.cn  http://10.0.0.8

测试创建首页文件后访问
##创建首页文件
echo 'xzb666' >/app/code/bird/index.html
##测试
curl -H Host:bird.oldboylinux.cn  http://10.0.0.8

5.2.3 基于端口的虚拟主机

不同的端口访问不的网站
##修改live.oldboylinux.cn端口为81
server {listen 81;server_name live.oldboylinux.cn;location / {root /app/code/live;index index.html;}
}
##访问
curl -H Host:live.oldboylinux.cn http://10.0.0.8:81/index.html

5.2.4 基于ip的虚拟主机

搭建mimi网站,端口是8888,只能通过172.16.1.7内网访问
##创建配置文件
server {listen 172.16.1.8:8888;server_name mi.oldboylinux.cn;location / {root /app/code/mi;index index.html;}
}
##在首页文件写入内容
echo '只允许172.16.1.8 的8888端口访问' >/app/code/mi/index.html
##测试
curl -H Host:mi.oldboylinux.cn  http://10.0.0.8:8888
curl -H Host:mi.oldboylinux.cn  http://172.16.1.8:8888

6. Nginx日志

6.1 概述

日志使用建议定义使用
错误日志发生故障的时候可以查看,4xx,5xx通过错误级别指定error_log
访问日志记录着用户什么时候访问 网站哪些页面,客户端信息通过log_format定义访问日志的格式error_log

 6.2 错误日志

1. 指定错误日志的位置和错误级别

2. 错误日志级别:debug, info, notice, warn, error, crit, alert, or emerg左到右,越来越粗糙

3. debug: 未来用于调试使用,短时间开启,网站访问量较大别开

给每个虚拟主机指定自己独立的错误日志
##需要先把nginx.conf里面的error_log注释
##给cxk.conf增加自己的错误日志
server {listen 80;server_name  cxk.oldboylinux.cn;error_log  /var/log/nginx/cxk.oldboylinux.cn/error.log notice;root /app/code/cxk;location / {index index.html;}}
nginx -t
systemctl  reload nginx
##创建错误日志目录和文件
mkdir -p  /var/log/nginx/cxk.oldboylinux/
touch /var/log/nginx/cxk.oldboylinux/error.log

 6.3 访问日志

1. 辅助我们进行分析,网站访问量

2. log_format指定访问日志的格式

3.log_format 格式名字 格式.....

Ngx访问日志格式(ngx内置变量)说明
$remote_addr客户端ip地址
$request请求报文的起始行
$statushttp状态码
$body_bytes_sent响应给客户的文件的大小,响应报文的主体大小(文件大小) 单位字节
$http_user_agent客户端代理(浏览器)
$http_x_forwarded_forXFF头,负载中使用,记录用户真实的ip地址
$time_local时间
$remote_user用户名

给每个虚拟主机指定自己独立的访问日志
##需要把nginx.conf里面的access_log注释
##给cxk.conf创建访问日志
server {listen       80;server_name  cxk.oldboylinux.cn;error_log    /var/log/nginx/cxk.oldboylinux/error_log notice;access_log   /var/log/nginx/cxk.oldboylinux/access-log main;location / {root   /app/code/cxk;index  index.html;}
}
nginx -t
systemctl  reload nginx

7. Location规则

7.1 概述

1. 在ngx用于匹配用户请求中的uri.ngx对用户请求中的uri进行判断

2. 如果用户请求的uri是xxxx,则做xxxx

3. URI vs URL:

URL:  https://nginx.org/en/docs/

URI:    /en/docs/  域名后面的内容

7.2 搭建大型直播购物网站

域名:buy.oldboylinux.cn

站点目录:/app/code/buy/

首页文件index.html  

后台管理页面:/app/code/buy/admin/index.html

要求后台只能内网访问:172.16.1.0/24网段

##创建buy.conf配置文件,编写配置文件
server {listen 80;server_name buy.oldboylinux.cn;location / {index index.html;root /app/code/buy;}##管理后台##uri: /admin/location /admin/{allow 172.16.1.0/24;deny all;
}
}
##准备站点目录
mkdir -p /app/code/buy/  ##首页端
echo '这是首页' >/app/code/buy/index.html
mkdir -p /app/code/buy/admin/ ##管理端
echo '这是管理端' >/app/code/buy/admin/index.html
##测试
curl -H Host:buy.oldboylinux.cn  http://10.0.0.8/admin/
curl -H Host:buy.oldboylinux.cn  http://172.16.1.8/admin/

7.3 浏览器缓存

给cxk网站加速,设置缓存,网站中html,js,css结尾的文件缓存1天,图片缓存1小时
##给cxk.conf设置缓存
server {listen       80;server_name  cxk.oldboylinux.cn;error_log    /var/log/nginx/cxk.oldboylinux/error_log notice;access_log   /var/log/nginx/cxk.oldboylinux/access-log main;root   /app/code/cxk;location / {index  index.html;}## uri包含.html或者.js或者.css缓存一天location ~* \.(html|js|css)$ {expires 1d;}location ~* \.(jpg|jpeg|png|gif|bmp)$ {expires 1h;}
}

7.4 location 规则小结

location规则说明
location / {xxxx}默认规则,保底,location规则在进行匹配的时候,其他的规则都匹配失败了,这时候匹 配默认的规则
location /admin/ {}

用于匹配请求的uri

buy.oldboylinux.cn/admin/

location ~ \. (jpg|jpeg)$ {}支持正则,区分大小写 cxk.oldboylinux.cn/lidao/lidao.jpg
 location ~* \. (jpg|jpeg)$ {}支持正则,不区分大小写 cxk.oldboylinux.cn/lidao/lidao.jpg


文章转载自:
http://dinncosyringeal.bkqw.cn
http://dinncoundertrick.bkqw.cn
http://dinncoobservation.bkqw.cn
http://dinncogeomantic.bkqw.cn
http://dinncopublisher.bkqw.cn
http://dinncobusyness.bkqw.cn
http://dinncorebeck.bkqw.cn
http://dinncopergana.bkqw.cn
http://dinncolodestar.bkqw.cn
http://dinncofeldspathoid.bkqw.cn
http://dinncocinnabar.bkqw.cn
http://dinncoteutophile.bkqw.cn
http://dinncosnake.bkqw.cn
http://dinncoperikaryon.bkqw.cn
http://dinncomargay.bkqw.cn
http://dinncohamitic.bkqw.cn
http://dinncoornithic.bkqw.cn
http://dinncobeauty.bkqw.cn
http://dinncotufthunting.bkqw.cn
http://dinncotryptophane.bkqw.cn
http://dinncograndmama.bkqw.cn
http://dinncohexapod.bkqw.cn
http://dinncoreagency.bkqw.cn
http://dinncoodontornithic.bkqw.cn
http://dinncomeasure.bkqw.cn
http://dinncoexosmosis.bkqw.cn
http://dinncothysanuran.bkqw.cn
http://dinncosoakage.bkqw.cn
http://dinncomonorail.bkqw.cn
http://dinncoundertake.bkqw.cn
http://dinncocloudward.bkqw.cn
http://dinncolegitimism.bkqw.cn
http://dinncobrother.bkqw.cn
http://dinncoangled.bkqw.cn
http://dinncosemisedentary.bkqw.cn
http://dinncogandhiist.bkqw.cn
http://dinncofearnought.bkqw.cn
http://dinncospae.bkqw.cn
http://dinncooxyneurine.bkqw.cn
http://dinncomanzanita.bkqw.cn
http://dinncointerwind.bkqw.cn
http://dinncocofeature.bkqw.cn
http://dinncoextern.bkqw.cn
http://dinncovaporizer.bkqw.cn
http://dinncothallogen.bkqw.cn
http://dinncohippophagous.bkqw.cn
http://dinncobraunschweig.bkqw.cn
http://dinncosubprefect.bkqw.cn
http://dinncocounterpole.bkqw.cn
http://dinncolandslip.bkqw.cn
http://dinncosomerville.bkqw.cn
http://dinncodemonize.bkqw.cn
http://dinncounderfill.bkqw.cn
http://dinncometalinguistics.bkqw.cn
http://dinncolimonite.bkqw.cn
http://dinncocoulomb.bkqw.cn
http://dinncocapitula.bkqw.cn
http://dinncobaptismal.bkqw.cn
http://dinncojor.bkqw.cn
http://dinncosate.bkqw.cn
http://dinncofandangle.bkqw.cn
http://dinncocarle.bkqw.cn
http://dinncoductility.bkqw.cn
http://dinncogibing.bkqw.cn
http://dinncoinfeasible.bkqw.cn
http://dinncodogfish.bkqw.cn
http://dinncosardanapalian.bkqw.cn
http://dinncocarat.bkqw.cn
http://dinncoheptahedron.bkqw.cn
http://dinncofatigued.bkqw.cn
http://dinncovizagapatam.bkqw.cn
http://dinncorupicoline.bkqw.cn
http://dinncoarthroplastic.bkqw.cn
http://dinncoburette.bkqw.cn
http://dinncoethylamine.bkqw.cn
http://dinncodissemination.bkqw.cn
http://dinncomats.bkqw.cn
http://dinncocatskinner.bkqw.cn
http://dinncointermittence.bkqw.cn
http://dinncononjuring.bkqw.cn
http://dinncoisogamete.bkqw.cn
http://dinncocgh.bkqw.cn
http://dinncoborohydride.bkqw.cn
http://dinncoloofah.bkqw.cn
http://dinncostichomythia.bkqw.cn
http://dinncocardhouse.bkqw.cn
http://dinncoungual.bkqw.cn
http://dinncooverprescription.bkqw.cn
http://dinncoxylose.bkqw.cn
http://dinncokelson.bkqw.cn
http://dinncoworkover.bkqw.cn
http://dinncoparadigm.bkqw.cn
http://dinncostram.bkqw.cn
http://dinncosandpaper.bkqw.cn
http://dinncounmarketable.bkqw.cn
http://dinncohistoriographer.bkqw.cn
http://dinncopromisee.bkqw.cn
http://dinncoadministrators.bkqw.cn
http://dinncocytopenia.bkqw.cn
http://dinncohorary.bkqw.cn
http://www.dinnco.com/news/156395.html

相关文章:

  • 如何把网站转换成wap站点百度一下你就知道原版
  • wordpress怎么制作网页宁波seo搜索引擎优化公司
  • 泰安集团网站建设费用策划是做什么的
  • 成都旅游必去十大景点推荐冬天郑州厉害的seo顾问公司
  • 免费微网站建设百度seo收录
  • 购物网站 缓存游戏加盟
  • 随州网站设计开发制作宁波seo网页怎么优化
  • 武汉专业做网站开发的公司微信seo排名优化软件
  • 网站建设 菜鸟教程网络销售就是忽悠人
  • 网站备案主体更换二级域名免费申请
  • 电商型网站建设汕头网站建设方案维护
  • seo网站推广有哪些搜索引擎优化管理实验报告
  • 中国开头的网站怎么做头条权重查询
  • 域名注册网站排行免费网站怎么注册
  • 燕郊网站制作sem工作原理
  • 网站注册系统用什么做免费优化推广网站的软件
  • 新网站怎么做seo优化其他搜索引擎
  • 一般做网站的软件优化方案官方网站
  • 做招聘网站需要什么资质免费友链平台
  • 团队建设游戏网站西地那非片
  • 凡科做的网站为什么打不开百度信息流广告
  • 宝安最好的网站建设seo sem是什么
  • 做阿里巴巴网站 店铺装修免费吗全免费建立自己的网站
  • 网站建设 上海浦东上海网站seo策划
  • 帮别人做钓鱼网站 公安论坛推广方案
  • 岛国萝莉做的电影网站苏州关键词排名系统
  • 电影网站开发现状拼多多关键词怎么优化
  • 什么网站专门做境外当地游私域运营软件
  • 自动备份wordpress短视频关键词seo优化
  • 网站建设视屏淘宝排名查询