NGINX相关知识
---------------------------------------
nginx 和 tengine(淘宝) 类似,
1.查看网站的head头:
curl -I www.51cto.com
2.安装nginx步骤:
一。先安装pcre依赖,rewrite需要用:
yum install pcre pcre-devel openssl-devel
二。到http://nginx.org官网下载稳定版本:
tar -zxvf nginx-1.10.2.tar.gz ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx \ --with-http_ssl_module --with-http_stub_status_module make && make install useradd nginx -s /sbin/nologin -M
3.查看安装时的参数:
./sbin/nginx -V
4.配置文件:
worker_processes 1; 线程数,配置成CPU核数 worker_connections 1024; 每个worker允许的最大并发数
5.生效配置:
./sbin/nginx -t 测试配置文件是否正确
./sbin/nginx -s reload 加载配置文件
6.使用include优化配置文件:
include vhost/*.conf;7.查看nginx的状态信息:
vim conf/vhost/status.conf
server{ listen 80; server_name status.wmj.com; location / { stub_status on; access_log off; } }
8.error日志配置:
vim conf/nginx.conf
error_log logs/error.log error; 可以放在 http,server 头里面9.访问日志配置:
vim conf/nginx.conf
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" "$request_time"';vim conf/vhost/bbs.conf
access_log logs/bbs_access.log main;
10.重定向rewrite的使用:
server { listen 80; server_name rewrite.wmj.com; access_log logs/www_access.log main; rewrite ^/(.*) http://www.wmj.com/$1 permanent; } 将"http://rewrite.wmj.com/wmj.html"重定向到"http://www.wmj.com/wmj.html" permanent: 表示301重定向,没有的话是302
相关推荐
nginx学习笔记.zip
nginx学习笔记.docx
5Nginx学习笔记1
资源nginx 学习笔记实用知识库分享知识分享
这是我自学nginx的学习笔记,上传只是为了更好的督促自己学习,如果你也有同感,加入一起学习吧。
Nginx教程
安装 和使用安装常用命令配置文件nginx.conf配置文件三部分组成:全局块,event块,http块全局块:从配置文件开始到events块之间的内容,主要设
nginx集群,分布式服务架构,特点:热部署,可高并发连接,低内存消耗,处理响应快,可靠性高等
Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器。
Nginx学习笔记
Nginx对请求的处理是通过事件触发的,模块作为事件消费者,只能被事件收集、分发器调用。在Nginx中,接收到一个请求时,不会产生一个单独的进程来处理该请求,而是由事件收集、分发器(进程)调用某个模块,由模块处理...
ngnix完整的系统学习资料,包括安装、部署、配置、调优、负载均衡、反向代理,location详细介绍
Nginx第二天学习笔记
Nginx第三天学习笔记
Nginx第一天学习笔记
Nginx的nginx学习笔记配合原始币可食用