标签:
1.安装nginx
cd /usr/local/
wget http://nginx.org/download/nginx-1.2.8.tar.gz
tar -zxvf nginx-1.2.8.tar.gz
cd nginx-1.2.8
./configure --prefix=/usr/local/nginx
make
make install
2.配置 参考地址
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream www.aaa.com {
server 124.205.16.69:8090;
}
upstream www.bbb.com {
server 124.205.16.69:8100;
}
server {
listen 80;
server_name www.aaa.com;
location / {
index index.html index.jsp;
proxy_pass http://www.aaa.com;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100m;
}
}
server {
listen 80;
server_name www.bbb.com;
location / {
index index.html index.jsp;
proxy_pass http://www.bbb.com;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100m;
}
}
}
3.需要注意的问题:
/usr/local/nginx/sbin/nginx -s reload 用改名了重载可能不会生效
如果发现没有生效,则需要传重启。
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx
至于nginx的一些常用功能点和原理性东西后续文章中会系统介绍,敬请期待。
标签:
原文地址:http://www.cnblogs.com/kevin7234/p/4622814.html