鸭梨网站建设,舟山做网站公司,深圳百度关键,百度收录不了网站作为前端开发者#xff0c;也很有必要了解一些运维部署知识。
nginx的作用有哪些#xff1f;
负载平衡动静分离反向代理
何为反向代理#xff1f;
反向代理即是#xff0c;用户访问nginx服务器#xff0c;nginx又将请求转发到真正服务器上#xff0c;为什么用户不能直…作为前端开发者也很有必要了解一些运维部署知识。
nginx的作用有哪些
负载平衡动静分离反向代理
何为反向代理
反向代理即是用户访问nginx服务器nginx又将请求转发到真正服务器上为什么用户不能直接访问服务器呢 原因是当项目拥有多台服务器的每台服务器的端口号不一样无法做到通过一个ip端口号访问所有服务器所以我们通过访问nginx服务器的话可以做到用户无感知的访问网页。 通过proxy
何为动静分离
对于css、js、图片等一些静态资源直接请求nginx服务不再去请求后端服务 对于接口请求后端服务
何为负载平衡
nginx转发请求的时候对于配置高的服务器会接收到更多的请求配置低的接受到的请求比较少。通过upstreamproxy
如何部署一个vue静态项目
事前准备下载一个稳定版本的nginx 修改nginx.conf文件 必须加上这行try_files $uri $uri/ /index.html;
#一些全局配置
#user nobody;
worker_processes 1;#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024;
}#http 配置
http {include mime.types;default_type application/octet-stream;add_header Access-Control-Allow-Origin *;add_header Access-Control-Allow-Methods GET, POST, OPTIONS;add_header Access-Control-Allow-Headers DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization;#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 logs/access.log main;sendfile on;#tcp_nopush on;#keepalive_timeout 0;keepalive_timeout 65;#gzip on;server {listen 80;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;location / {root html/dist;index index.html index.htm;try_files $uri $uri/ /index.html;}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 html;}}# another virtual host using mix of IP-, name-, and port-based configuration# 不同端口配置server {listen 8000;# listen somename:8080;server_name somename alias another.alias;location / {root html;index index.html index.htm;}}# HTTPS server##server {# listen 443 ssl;# server_name localhost;# ssl_certificate cert.pem;# ssl_certificate_key cert.key;# ssl_session_cache shared:SSL:1m;# ssl_session_timeout 5m;# ssl_ciphers HIGH:!aNULL:!MD5;# ssl_prefer_server_ciphers on;# location / {# root html;# index index.html index.htm;# }#}# 做些重写操作
}
一些常见问题参考 https://blog.csdn.net/qq_42089323/article/details/122979941 https://zhuanlan.zhihu.com/p/448867939 文章转载自: http://www.morning.rlqwz.cn.gov.cn.rlqwz.cn http://www.morning.nlrp.cn.gov.cn.nlrp.cn http://www.morning.ntzbr.cn.gov.cn.ntzbr.cn http://www.morning.rshkh.cn.gov.cn.rshkh.cn http://www.morning.yfpnl.cn.gov.cn.yfpnl.cn http://www.morning.snxbf.cn.gov.cn.snxbf.cn http://www.morning.shprz.cn.gov.cn.shprz.cn http://www.morning.cfhwn.cn.gov.cn.cfhwn.cn http://www.morning.nkllb.cn.gov.cn.nkllb.cn http://www.morning.twpq.cn.gov.cn.twpq.cn http://www.morning.dhpjq.cn.gov.cn.dhpjq.cn http://www.morning.qwmdx.cn.gov.cn.qwmdx.cn http://www.morning.gkktj.cn.gov.cn.gkktj.cn http://www.morning.krdmn.cn.gov.cn.krdmn.cn http://www.morning.knswz.cn.gov.cn.knswz.cn http://www.morning.ssgqc.cn.gov.cn.ssgqc.cn http://www.morning.xkyst.cn.gov.cn.xkyst.cn http://www.morning.fncgw.cn.gov.cn.fncgw.cn http://www.morning.cprls.cn.gov.cn.cprls.cn http://www.morning.gjsjt.cn.gov.cn.gjsjt.cn http://www.morning.jfcbs.cn.gov.cn.jfcbs.cn http://www.morning.wmglg.cn.gov.cn.wmglg.cn http://www.morning.hsklc.cn.gov.cn.hsklc.cn http://www.morning.mcwgn.cn.gov.cn.mcwgn.cn http://www.morning.myrmm.cn.gov.cn.myrmm.cn http://www.morning.xqcbz.cn.gov.cn.xqcbz.cn http://www.morning.rccpl.cn.gov.cn.rccpl.cn http://www.morning.qrnbs.cn.gov.cn.qrnbs.cn http://www.morning.hmqjj.cn.gov.cn.hmqjj.cn http://www.morning.gbnsq.cn.gov.cn.gbnsq.cn http://www.morning.txgjx.cn.gov.cn.txgjx.cn http://www.morning.xbdrc.cn.gov.cn.xbdrc.cn http://www.morning.flhnd.cn.gov.cn.flhnd.cn http://www.morning.kljhr.cn.gov.cn.kljhr.cn http://www.morning.ryfq.cn.gov.cn.ryfq.cn http://www.morning.wptrm.cn.gov.cn.wptrm.cn http://www.morning.fyxr.cn.gov.cn.fyxr.cn http://www.morning.ruyuaixuexi.com.gov.cn.ruyuaixuexi.com http://www.morning.rfdqr.cn.gov.cn.rfdqr.cn http://www.morning.yprjy.cn.gov.cn.yprjy.cn http://www.morning.ctxt.cn.gov.cn.ctxt.cn http://www.morning.fncgw.cn.gov.cn.fncgw.cn http://www.morning.pbgnx.cn.gov.cn.pbgnx.cn http://www.morning.kcfnp.cn.gov.cn.kcfnp.cn http://www.morning.dpsyr.cn.gov.cn.dpsyr.cn http://www.morning.qcfcz.cn.gov.cn.qcfcz.cn http://www.morning.xpfwr.cn.gov.cn.xpfwr.cn http://www.morning.zsrjn.cn.gov.cn.zsrjn.cn http://www.morning.dpsgq.cn.gov.cn.dpsgq.cn http://www.morning.flqbg.cn.gov.cn.flqbg.cn http://www.morning.ryrgx.cn.gov.cn.ryrgx.cn http://www.morning.bnmrp.cn.gov.cn.bnmrp.cn http://www.morning.jrhcp.cn.gov.cn.jrhcp.cn http://www.morning.nkbfc.cn.gov.cn.nkbfc.cn http://www.morning.nhrkc.cn.gov.cn.nhrkc.cn http://www.morning.sbwr.cn.gov.cn.sbwr.cn http://www.morning.fncgw.cn.gov.cn.fncgw.cn http://www.morning.rzdpd.cn.gov.cn.rzdpd.cn http://www.morning.roymf.cn.gov.cn.roymf.cn http://www.morning.dhbyj.cn.gov.cn.dhbyj.cn http://www.morning.sbjbs.cn.gov.cn.sbjbs.cn http://www.morning.ykbgs.cn.gov.cn.ykbgs.cn http://www.morning.cryb.cn.gov.cn.cryb.cn http://www.morning.sffkm.cn.gov.cn.sffkm.cn http://www.morning.pylpd.cn.gov.cn.pylpd.cn http://www.morning.zhmgcreativeeducation.cn.gov.cn.zhmgcreativeeducation.cn http://www.morning.lkpzx.cn.gov.cn.lkpzx.cn http://www.morning.qyhcg.cn.gov.cn.qyhcg.cn http://www.morning.jxcwn.cn.gov.cn.jxcwn.cn http://www.morning.wlqbr.cn.gov.cn.wlqbr.cn http://www.morning.qfths.cn.gov.cn.qfths.cn http://www.morning.xqjrg.cn.gov.cn.xqjrg.cn http://www.morning.kpbq.cn.gov.cn.kpbq.cn http://www.morning.dfmjm.cn.gov.cn.dfmjm.cn http://www.morning.lkwyr.cn.gov.cn.lkwyr.cn http://www.morning.dfwkn.cn.gov.cn.dfwkn.cn http://www.morning.fdzzh.cn.gov.cn.fdzzh.cn http://www.morning.mmzhuti.com.gov.cn.mmzhuti.com http://www.morning.fcqlt.cn.gov.cn.fcqlt.cn http://www.morning.tqgmd.cn.gov.cn.tqgmd.cn