大数据全系列 教程
1869个小节阅读:467.3k
408考研
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
xxxxxxxxxx
#全局块
# 指定可以运行nginx服务的用户和用户组,只能在全局块配置
#user nobody;
#nginx进程,一般数值为cpu核数
worker_processes 1;
#错误日志存放目录
#error_log logs/error.log; # warn error
#error_log logs/error.log notice;
#error_log logs/error.log info;
#进程pid存放位置
#pid logs/nginx.pid;
#event块
#工作模式及连接数上限
events {
#单个后台worker process进程的最大并发链接数
worker_connections 1024;
}
#http块
#http块是Nginx服务器配置中的重要部分,代理、缓存和日志定义等绝大多数的功能
#和第三方模块的配置都可以放在这个模块中。
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"';
#nginx访问日志
#access_log logs/access.log main;
#开启高效传输模式
sendfile on;
#激活tcp_nopush参数可以允许把httpresponse header和文件的开始放在一个文件里发布, 积极的作用是减少网络报文段的数量
#tcp_nopush on;
#连接超时时间,单位是秒
#keepalive_timeout 0;
keepalive_timeout 65;
#开启gzip压缩功能
#gzip on;
#server块
#server块和“虚拟主机”的概念有密切联系。
server {
#监听端口
listen 80;
server_name localhost;
#编码识别
#charset koi8-r;
#日志格式及日志存放路径 /usr/local/nginx/
#access_log logs/host.access.log main;
location / {
#站点根目录,即网站程序存放目录 /usr/local/nginx/html
root html;
#首页排序
index index.html index.htm;
}
#错误页面
#error_page 404 /404.html;
# 将服务器错误页面重定向到静态页面/50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html { #/usr/local/nginx/html/50x.html
root html;
}
#代理PHP脚本到Apache上监听127.0.0.1:80
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
#将PHP脚本传递到正在监听127.0.0.1:9000的FastCGI服务器
#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;
#}
#如果Apache的文档根目录与nginx的根目录一致,则拒绝访问.htaccess文件
#location ~ /\.ht {
# deny all;
#}
}
#另一个虚拟主机,混合使用IP、名称和基于端口的配置
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server { # https
# listen 443 ssl;
# server_name localhost;
# 服务的证书
# ssl_certificate cert.pem;
# 服务端key
# 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;
# }
#}
}