发布时间:2022-11-12 10:30
./nginx 启动
./nginx -s stop 快速停止
./nginx -s quit 优雅关闭,在退出前完成已经接受的连接请求
./nginx -s reload 重新加载配置
user root;
#工作线程数,最佳配为当前主机的CPU内核数
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 {
# include 引入外部的文件
# mime.types 记录了文件后缀名对应的处理类型
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;
# 连接超时时间 单位是s
keepalive_timeout 65;
#gzip on;
server {
# 监听端口
listen 80;
# 域名、主机名
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
# /是域名之后跟的内容
location / {
# 资源路径 html是相对路径
root html;
# 默认加载该路径下的文件名
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
# 出现以下错误码 跳转到/50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root 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;
#}
}
# 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;
# }
#}
}
先精准,后头通配符,再尾通配符,最后正则
location / {
# 反向代理到http://www.baidu.com,但不支持https
proxy_pass http://www.baidu.com
}
负载均衡策略
十大报表工具 BI 产品深度点评-----BI报表行业专家干货分享----一文读懂报表与BI的行业现状----最新常用BI报表工具对比科普帖
i.MX6ULL终结者Linux 电容触摸屏实验使用Linux内核自带的ft5426驱动
如何在pycharm中导入pandas,numpy,matplotlib这三个包
醒醒,该刷题了!——LeetCode_7_ReverseInteger
JAVA面试都有Spring考题,还有必要去考Spring认证(证书)吗?
在 SAP ABAP 系统对事物码 SEGW 创建的 OData 服务进行配置并测试试读版
Vue2.7正式发布!代号为:Naruto(火影忍者),原生支持 Composition API +终于可以在Vue2项目中使用Vue3的新特性了,真香~