由于篇幅有限,下篇的面试技术攻克篇只能够展示出部分的面试题,详细完整版以及答案解析,有需要的可以关注
docker cp nzc-nginx:/etc/nginx/conf.d /home/nginx/
docker cp nzc-nginx:/usr/share/nginx/html /home/nginx/ #此处就是网站站点目录
#### 4、暂停、删除容器
查看所有正在运行的容器
docker ps
docker ps -a #查看所有容器
暂停、删除容器
docker stop nzc-nginx # nzc-nginx 容器| 容器ID 也可以,只需要前3位数字即可
docker rm nzc-nginx
docker rm -f nzc-nginx #直接删除正在运行的容器
#### 5、重新启动一个挂载目录的容器
docker run
-p 80:80
–name nzc-nginx
-v /home/nginx/nginx.conf:/etc/nginx/nginx.conf
-v /home/nginx/conf.d:/etc/nginx/conf.d
-v /home/nginx/logs:/var/log/nginx
-v /home/nginx/html:/usr/share/nginx/html
-d nginx:latest
测试:可以成功访问就是成功启动啦。
### 二、Nginx 配置文件讲解
本小章节只是针对与项目有关联配置文件进行一番简单的讲解,更详细的可能就需要大家去找找其他创作者所写的文章啦。望大家见谅
我们先看看之前上文提了一嘴的主配置文件:
nginx.conf
user nginx;
worker_processes auto;
# error_log 输出目录
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
# 单个工作进程可以允许同时建立外部连接的数量
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - time_local] “status http_referer” ’
‘“http_x_forwarded_for”’;
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65; #连接存活时间
#gzip on; 支持传递压缩文件
# nginx 配置文件中支持 include ,即支持多配置文件组合
include /etc/nginx/conf.d/*.conf;
}
你可别小瞧这个文件,里面有不少设置的开关勒,不过这次不是写这里~~
继续来到 `default.conf`
server {
# 这里就是表示监听的端口
listen 80;
listen [::]:80;
# 这里表示服务地址 写域名或者ip
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
# 这里就是我们今天要接触的东西了
# / 表示的是 ip:port后面跟着的路径 / 就是 ip:port/
# 如果是 /nzc 访问的时候就是 ip:port/nzc/
#基于这个逻辑,我们就可以运行多个站点
# 这里还可以写表达式、正则表达式等
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;
}
# 反向代理的例子
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ .php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache’s document root
# concurs with nginx’s one
#
# 黑名单白名单功能
#location ~ /.ht {
# deny all;
#}
}
### JavaScript
* js的基本类型有哪些?引用类型有哪些?null和undefined的区别。
* 如何判断一个变量是Array类型?如何判断一个变量是Number类型?(都不止一种)
* Object是引用类型嘛?引用类型和基本类型有什么区别?哪个是存在堆哪一个是存在栈上面的?
* JS常见的dom操作api
* 解释一下事件冒泡和事件捕获
* 事件委托(手写例子),事件冒泡和捕获,如何阻止冒泡?如何组织默认事件?
* 对闭包的理解?什么时候构成闭包?闭包的实现方法?闭包的优缺点?
* this有哪些使用场景?跟C,Java中的this有什么区别?如何改变this的值?
* call,apply,bind
* 显示原型和隐式原型,手绘原型链,原型链是什么?为什么要有原型链
* 创建对象的多种方式
* 实现继承的多种方式和优缺点
* new 一个对象具体做了什么
* 手写Ajax,XMLHttpRequest
* 变量提升
* 举例说明一个匿名函数的典型用例
* 指出JS的宿主对象和原生对象的区别,为什么扩展JS内置对象不是好的做法?有哪些内置对象和内置函数?
* attribute和property的区别
* document load和document DOMContentLoaded两个事件的区别
* JS代码调试