大纲
1.从单体到集群过渡
2.Nginx
2.1什么是nginx
2.2常见服务器
2.3nginx在架构中所处位置
2.4使用率,性能,市场占有率等信息
2.5正反向代理啥意思
正向代理
反向代理
示例
2.6安装步骤
Nginx安装步骤 常用命令等
2.7请求链路
2.8进程模型
通用模型 一个管事的 多个打工的
2.9通用命令
-s stop 强制关机
-s quit 保存当前配置然后关机
-s reload 刷新配置
-h 帮助命令 里面还有些别的常用命令
[root@VM-4-3-centos sbin]# ./nginx -s stop
[root@VM-4-3-centos sbin]# ./nginx -s quit
nginx: [error] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory)
[root@VM-4-3-centos sbin]# ./nginx
[root@VM-4-3-centos sbin]# ./nginx -s quit
[root@VM-4-3-centos sbin]# ./nginx -h
nginx version: nginx/1.22.1
Usage: nginx [-?hvVtTq] [-s signal] [-p prefix]
[-e filename] [-c filename] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-T : test configuration, dump it and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /usr/local/nginx/)
-e filename : set error log file (default: /var/log/nginx/error.log)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file
2.10核心配置文件各个配置的含义
#user nobody;
worker_processes 2;
#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 {
include mime.types;
default_type application/octet-stream;
#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 888;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root 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 html;
}
}
1.