Nginx学习笔记
2018-01-09 14:26
190 查看
命令:
启动:start nginx
检查配置是否正确:nginx -t
修改配置后重载:nginx -s reload
关闭:nginx -s stop
nginx+tomcat整合
配置文件 nginx.conf里
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
修改为:
server {
listen 80;
server_name localhost:8080;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://localhost:8080;
}
但是访问tomcat响应很慢,修改为:
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 1000m;
proxy_connect_timeout 1;
proxy_send_timeout 30;
proxy_read_timeout 60;
}
启动:start nginx
检查配置是否正确:nginx -t
修改配置后重载:nginx -s reload
关闭:nginx -s stop
nginx+tomcat整合
配置文件 nginx.conf里
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
修改为:
server {
listen 80;
server_name localhost:8080;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://localhost:8080;
}
但是访问tomcat响应很慢,修改为:
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 1000m;
proxy_connect_timeout 1;
proxy_send_timeout 30;
proxy_read_timeout 60;
}
相关文章推荐
- Nginx学习笔记(五) 源码分析&内存模块&内存对齐
- Nginx学习笔记(十二):核心结构体
- Nginx学习笔记
- NGINX学习笔记
- Nginx学习笔记~目录索引
- nginx学习笔记
- Nginx学习笔记(六) 源码分析&启动过程
- Nginx学习笔记(十四):创建worker子进程
- Nginx学习笔记二 -- nginx的配置
- nginx学习笔记(2):开发一个简单的HTTP模块
- Nginx学习笔记(一)
- Nginx学习笔记(一)---Linux下安装Nginx
- Nginx学习笔记(七) 创建子进程
- Nginx学习笔记(十五):ngx_setproctitle()
- Nginx学习笔记(一):nginx的安装和配置
- Nginx学习笔记
- Nginx学习笔记(一)——理解IO模型
- Nginx学习笔记(三)--- Nginx实现反向代理和配置负载均衡
- Nginx学习笔记(八) Nginx进程启动分析
- Nginx学习笔记(十八):事件处理框架