Location\httpd\反向代理

Location\httpd\反向代理

参考:http://tengine.taobao.org/nginx_docs/cn/docs/http/ngx_http_core_module.html

测试

在没安装nginx的虚拟机上安装httpd服务

[root@node2 ~]# yum install httpd -y
[root@node2 ~]# chkconfig
[root@node2 ~]#systemctl start httpd.service
[root@node2 ~]#

网页访问192.168.48.102,即可访问到默认的页面,即httpd服务启动成功

[root@node2 ~]# cd /var/www
[root@node2 ~]#ls
[root@node2 ~]#
[root@node2 ~]#vim index.html
from 192.168.48.102...
[root@node2 ~]#
浏览器访问192.168.48.102
from 192.168.48.102...
反向代理

配置nginx.conf文件

server {
        listen       80;
        server_name     www.123.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;  #以html的方式显示
            index  index.html index.htm;  #转发到index.html或index.htm
                   }
        location /test {
            proxy_pass http://192.168.48.102/;  #地址后面带/表示只访问当前目录,不拼接 /test
        }
   }

上一篇:UCSC浏览器的可视化


下一篇:在OpenGL ES和Android中处理大型位图