简单的配置了web反向代理,没有太复杂,还有待深入研究
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server{ //本机的web服务用作简单的centos源
listen 80;
server_name localhost;
location /centos{
alias /home/disk/centos/; //把centos 5.5 i386的光盘文件复制到这个目录下
autoindex on; //开启目录浏览
autoindex_exact_size off;
autoindex_localtime on;
}
location /centos64{
alias /home/disk/centos64/; //centos 5.6 64bit光盘文件复制到这个目录
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
}
server { //基于不同域名的反向代理
listen 80;
server_name webos.jason.net; //反向代理1
location / {
# root html;
#root /var/www/html/;
# index index.html index.htm;
proxy_pass http://192.168.16.176:80; //我在这个地址配置了eyeos
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarder-For $proxy_add_x_forwarded_for;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80; //反向代理2
server_name mail.jason.net;
location / {
proxy_pass http://192.168.16.177:80; //我在这个地址配置了extmail 网页邮件服务器
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarder-For $proxy_add_x_forwarded_for;
}
}
}