Nginx笔记总结一:基本安装和配置
2024-10-08 20:42:31
1. Nginx安装
下载地址和安装依赖包
http://nginx.org/download/nginx-1.9.14.tar.gz
yum -y install pcre pcre-devel zlib-devel openssl*
编译安装
./configure --prefix=/usr/local/nginx \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-pcre
启动,关闭,重启
/usr/local/nginx/sbin/nginx 启动
/usr/local/nginx/sbin/nginx -s stop 关闭
/usr/local/nginx/sbin/nginx -s reload 重启
/usr/local/nginx/sbin/nginx -t 检查配置
配置文件
user nobody;
worker_processes ;
error_log logs/error.log notice;
pid logs/nginx.pid;
events {
worker_connections ;
use epoll;
}
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 ;
gzip on; upstream proxy1 {
server 192.168.89.10:;
}
upstream proxy2 {
server 192.168.89.10:;
} server {
listen ;
server_name www1.dlab.com;
location / {
proxy_pass http://proxy1;
}
} server {
listen ;
server_name www2.dlab.com;
location / {
proxy_pass http://proxy2;
}
}
}
最新文章
- Maven之构件
- python征程2.0(python基础)
- zk textbox 更改字体大小及高度
- 关键字volatile
- [爬虫资源]各大爬虫资源大汇总,做我们自己的awesome系列
- Minimum Height Trees
- 安装 chardet ,出现ImportError: No module named setuptools
- hash表的建立和查找
- ui router digest 10 time
- android入门——UI(4)
- jQuery EasyUI 数字框(NumberBox)用法
- HTML5游戏开发引擎Pixi.js完全入门手册(二)元素对象属性解析
- 记录一个 spring cloud 配置中心的坑,命令行端口参数无效,被覆盖,编码集问题无法读取文件等.
- 冲刺NO.7
- C语言复习0_准备工作
- gsoap内存管理与释放
- Excel数据与DateTable数据的转换
- Chrome中无法断点调试的解决方案
- C#集合Collections购物车Shopping Cart
- 浅谈分词算法(4)基于字的分词方法(CRF)