网站首页 > 技术教程 正文
1、Nginx的nginx.conf文件详解:
root@ha1 conf]# cat nginx.conf
#user nobody; 使用的用户和组 eg user nginx nginx
worker_processes 1; 指定工作衍生进程数(一般等于cpu的总核数的俩倍)
#error_log logs/error.log; 指定错误日志存放的路径
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid; 指定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; 是否开启gzip压缩
server {
listen 80;
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;
}
# 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;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
[root@ha1 conf]#
2、总结
通过nginx.conf文件的展示,大致可以看出,nginx.conf的配置文件结构主体结构主要由以下几部分构成:
3、下一节笔者将会详细介绍Nginx虚拟主机的配置,请关注哦
猜你喜欢
- 2024-10-10 「Ansible专栏」Ansible条件判断的介绍和使用
- 2024-09-12 Linux自动化进阶:Ansible配置管理
- 2024-09-12 ELK总结—第三篇Logstash监控Nginx日志存入redis,实现服务解耦
- 2024-09-12 Nginx基本属性配置详解(nginx详细讲解)
- 2024-09-12 Welcome to nginx!(Welcome to nginx!怎么办)
- 2024-09-12 Nginx 解决error.log和access.log日志的改善总结
- 2024-09-12 C++后端开发必须彻底搞懂Nginx,从原理到实战(高级篇)
- 2024-09-12 nginx负载均衡-普通hash和一致性hash负载均衡实现
- 2024-09-12 架构师成长之路:Nginx+Keepalived搭建高可用集群
- 2024-09-12 Nginx + Keepalived 高可用之主从配置
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)