Nginx配置文件服务管理
来源:互联网 发布:游戏淘宝网商城 编辑:程序博客网 时间:2024/05/16 16:15
Nginx配置文件服务管理
cd /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.default
1,event 网络模型的定义
event{网络定义模型}
2,http的配置
http{ 网站整体环境配置 server{ //--server--一个可以访问的网站 一个可以访问的web服务器 //--server--一般在这里修改 } //--server--绑定虚拟主机,多加几个server即可}
3,配置文件详情
[root@iZwz9h901rvv69020rk7fsZ conf]# vim nginx.conf user www www; #是nginx服务的伪用户,伪用户组 worker_processes auto; #启动进程,通常设置成cup数量相等,相当于cpu的个数 error_log /home/wwwlogs/nginx_error.log crit; #错误日志 pid /usr/local/nginx/logs/nginx.pid; #主进程pid保存文件 google_perftools_profiles /tmp/tcmalloc; #Specifies the value for maximum file descriptors that can be opened by this process. worker_rlimit_nofile 51200; #文件描述符的数量 events { use epoll; #网络I/O模型 worker_connections 51200 #工作进程最大允许的连接数 } http { include mime.types; default_type application/octet-stream; #设定mine类型,文件传送类型由mine.type文件定义 server_names_hash_bucket_size 128; #保存服务器名字的hash表大小 client_header_buffer_size 32k; #客户端请求头部缓冲区大小 large_client_header_buffers 4 32k; #最大客户端头缓冲大小 client_max_body_size 50m; #客户端最大上传文件大小 sendfile on; # 控制异步传输 tcp_nopush on; # 控制异步传输 keepalive_timeout 60; #连接超时时间 tcp_nodelay on; #禁用nagle算法,就是不缓存数据 fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 256k; #fastcgi 设置,主要是提高了fastcgi性能 gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 2; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_disable "MSIE [1-6]\."; #开启gzip网络压缩 #limit_conn_zone $binary_remote_addr zone=perip:10m; ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section. server_tokens off; #隐藏版本号,报错不会显示版本,比价安全 access_log off; #nginx日志 server { listen 80 default_server; #监听端口 #listen [::]:80 default_server ipv6only=on; server_name www.lnmp.org; #域名 index index.html index.htm index.php; #默认网页文件名 root /data/www; #网页主目录 #error_page 404 /404.html; autoindex on #开启文件列表功能 include enable-php.conf; #一下是nginx的网站核心配置,匹配等等,一般改动比较小 location /nginx_status { stub_status on; access_log off; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ /\. { deny all; } access_log /home/wwwlogs/access.log; } include vhost/*.conf; }
4,虚拟主机
其实所谓绑定虚拟主机,就是在配置文件中加server修改server中的server_name 域名 root 根目录注意: 为了不让主配置文件太杂太乱,专门加了一个vhost文件夹提供虚拟主机服务 可以在conf/vhost/下增加xxx(任意).conf文件单独写server来配置虚拟主机
0 0
- Nginx配置文件服务管理
- nginx服务二---nginx配置文件解释
- nginx服务三---nginx配置文件解释补充
- Nginx http服务相关的配置文件
- Centos6.6搭建nginx服务及配置文件详解
- nginx配置文件
- nginx配置文件
- Nginx配置文件
- nginx 配置文件
- nginx配置文件
- nginx配置文件
- nginx配置文件
- nginx 配置文件
- nginx配置文件
- Nginx 配置文件
- nginx配置文件
- nginx配置文件
- Nginx 配置文件
- OpenCV第一次尝试
- 训练记录
- LeetCode67. Add Binary
- C#项目””是针对”.NETFramework,Version=v4.5.2”但此计算机没有,需要修改为v4.5.1.
- 最大体积
- Nginx配置文件服务管理
- malloc/free 和 new/delete的联系和区别
- AndroidStudio自定义属性xmlns无法识别问题解决in Gradle projects,always use http://schemas.android.com/apk/res-aut
- CentOS7下安装vsftpd
- 常见数据结构小知识点总结
- Kali-WIFI攻防(七)----WPA密码破解之Hashcat
- 一维与二维树状数组
- 微信运营|如何利用微信后台数据优化微信运营
- STM32分配堆栈空间不足问题原因及解决方法