QT4编程之 - QTableWidget的运用
2010-05-20 20:13
411 查看
Nginx代理详解
通过代理IP去访问网站,可以去访问国外网站,达到翻墙等目的。
一、添加代理配置文件,[b]测试使用本地Nginx代理访问百度[/b]
[root@daixuan vhosts]# vim /usr/local/nginx/conf/vhosts/proxy.conf
server {
listen 80;
server_name www.baidu.com;
location / {
proxy_pass http://220.181.112.244/;
proxy_set_header Host $host;
}
}
二、使用多个IP代理访问百度
[root@daixuan vhosts]# curl -x127.0.0.1:80 www.baidu.com
可以访问
注:proxy_pass后面跟代理机器的IP,如果后端的机器有多台,还可以用upstream来实现负载均衡
upstream后面的名字是自定义的,这个名字会放在proxy_pass后面
安装dig,测试百度的多个IP
[root@daixuan vhosts]# yum install bind*
[root@daixuan vhosts]# dig www.baidu.com
www.baidu.com. 948 IN CNAME www.a.shifen.com.
www.a.shifen.com. 840 IN A 220.181.111.188
www.a.shifen.com. 840 IN A 220.181.112.244
[root@daixuan vhosts]# vim proxy.conf
upstream daixuan {
server 220.181.111.188:80;
server 220.181.112.244;
}
server {
listen 80;
server_name www.baidu.com;
location / {
proxy_pass http://daixuan/; proxy_set_header Host $host;
}
}
[root@daixuan vhosts]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@daixuan vhosts]# /etc/init.d/nginx reload
重新载入 Nginx: [确定]
[root@daixuan vhosts]# /etc/init.d/nginx restart
停止 Nginx: [确定]
正在启动 Nginx: [确定]
[root@daixuan vhosts]# curl -x127.0.0.1:80 www.baidu.com
可以访问
三、代理一个服务器上的多个域名
1、server_name
vim /usr/local/nginx/conf/vhosts/servername
加入如下内容:
server_name www.123.com www.daixuan.com www.abc.com;
当然可以继续添加
2、虚拟主机配置文件
vim /usr/local/nginx/conf/vhosts/proxy_all.conf
内容如下:
server;
{
listen 80;
include vhosts/servername;//这里的文件就是上面那个servername列表文件
location / {
proxy_pass http://1.1.1.2/; //这里是代理服务器的IP地址
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
access_log /dev/null;
}
本文出自 “梅花香自苦寒来!” 博客,请务必保留此出处http://daixuan.blog.51cto.com/5426657/1734731
通过代理IP去访问网站,可以去访问国外网站,达到翻墙等目的。
一、添加代理配置文件,[b]测试使用本地Nginx代理访问百度[/b]
[root@daixuan vhosts]# vim /usr/local/nginx/conf/vhosts/proxy.conf
server {
listen 80;
server_name www.baidu.com;
location / {
proxy_pass http://220.181.112.244/;
proxy_set_header Host $host;
}
}
二、使用多个IP代理访问百度
[root@daixuan vhosts]# curl -x127.0.0.1:80 www.baidu.com
可以访问
注:proxy_pass后面跟代理机器的IP,如果后端的机器有多台,还可以用upstream来实现负载均衡
upstream后面的名字是自定义的,这个名字会放在proxy_pass后面
安装dig,测试百度的多个IP
[root@daixuan vhosts]# yum install bind*
[root@daixuan vhosts]# dig www.baidu.com
www.baidu.com. 948 IN CNAME www.a.shifen.com.
www.a.shifen.com. 840 IN A 220.181.111.188
www.a.shifen.com. 840 IN A 220.181.112.244
[root@daixuan vhosts]# vim proxy.conf
upstream daixuan {
server 220.181.111.188:80;
server 220.181.112.244;
}
server {
listen 80;
server_name www.baidu.com;
location / {
proxy_pass http://daixuan/; proxy_set_header Host $host;
}
}
[root@daixuan vhosts]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@daixuan vhosts]# /etc/init.d/nginx reload
重新载入 Nginx: [确定]
[root@daixuan vhosts]# /etc/init.d/nginx restart
停止 Nginx: [确定]
正在启动 Nginx: [确定]
[root@daixuan vhosts]# curl -x127.0.0.1:80 www.baidu.com
可以访问
三、代理一个服务器上的多个域名
1、server_name
vim /usr/local/nginx/conf/vhosts/servername
加入如下内容:
server_name www.123.com www.daixuan.com www.abc.com;
当然可以继续添加
2、虚拟主机配置文件
vim /usr/local/nginx/conf/vhosts/proxy_all.conf
内容如下:
server;
{
listen 80;
include vhosts/servername;//这里的文件就是上面那个servername列表文件
location / {
proxy_pass http://1.1.1.2/; //这里是代理服务器的IP地址
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
access_log /dev/null;
}
本文出自 “梅花香自苦寒来!” 博客,请务必保留此出处http://daixuan.blog.51cto.com/5426657/1734731
相关文章推荐
- Qt QTableWidget小结
- QT QTableWidget 用法总结【转载】
- Qt入门-表格类QTableWidget
- 【Qt开发】QTableWidget的详细设置
- Qt下QTableWidget的使用
- QT QTableWidget 用法总结【转】
- QT 修改QTableWidget表头
- QT QTableWidget中实现整行选中和禁止编辑单元格
- qt QTableWidget&&QTableView 导出数据到excel
- QT QTableWidget 用法总结
- qt 中如何向QTableWidget里大量添加数据?
- qt中QTableWidget的使用
- QT QTableWidget 用法总结
- QT QTableWidget 用法总结
- Qt4 设置QTableWidget鼠标滑过的颜色
- QT QTableWidget 用法总结
- Qt QTableWidget小结
- Qt编程之右键单击QTreeWidgetItem弹出菜单
- Qt中QTableWidget用法总结
- QT QTableWidget导出为Excel格式