主要记录nginx.conf配置文件。
listen: 监听你的服务器端口
server_name : 转发到这个域名
location下配置您需要代理的网页或者您跳转的网页。
location / {
#这个文档为服务器本地文档
index 123.txt;
}
域名后面加上/目录实现301、302页面跳转。
location /302 {
rewrite ^/.* http://qq.com redirect;
proxy_pass http://qq.com;
}
location /301 {
rewrite ^/.* http://baidu.com permanent;
proxy_pass http://baidu.com;
}
对腾讯云cos 里的文件代理
location / {
#设置腾讯云的访问域名
proxy_set_header Host xxx-1251120927.cos.ap-shanghai.myqcloud.com;
#对cos文档下的test.html文档进行代理。
proxy_pass https://xxx-1251120927.cos.ap-shanghai.myqcloud.com/test.html;
}
保存退出后,重新加载nginx
./nginx -s reload
随后在浏览器输入域名就行。



