码迷,mamicode.com
首页 > 其他好文 > 详细

nginx简单配置

时间:2017-07-31 12:40:46      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:ade   stream   status   proc   head   name   request   forward   默认   

这里主要是配置upstream和server,其他的都没动,默认是服务器轮询方式主要目的是用于测试

user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/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 /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
upstream servers.mydomain.com{
server 192.168.233.128:8080;
server 192.168.233.129:8080;
server 192.168.233.131:8080;
}
server{
listen 80;
server_name www.mydomain.com;
location / {
proxy_pass http://servers.mydomain.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}

nginx简单配置

标签:ade   stream   status   proc   head   name   request   forward   默认   

原文地址:http://www.cnblogs.com/dayangcong/p/7262376.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!