nginx制作个人dns定向解析
2015-12-28 00:00
609 查看
摘要: nginx
使用nginx可以实现不同的dns指向同一个ip之后、通过server进行分发到不同的ip跟端口、也可以实现301、302等的重定向。
weibo.buxiasen.com
blog.buxiasen.com
类似这种效果、
因为域名没有备案、貌似在阿里云没办法加301跟nginx。。。
所以选择了使用亚马逊的临时服务器作为nginx中转 好绕。。
sudo apt-get install nginx 之后
在/etc/nginx/site-enabled 文件夹内加入以下一段文本、文件名任意
server{
server_name blog.buxiasen.com www.buxiasen.com;
location / {
proxy_pass http://jaonbu.github.io; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
就实现了blog地址的重映射
放入以下文本就可以实现301
实现weibo的301重定向
server{
server_name weibo.buxiasen.com
location / {
return 301 http://weibo.com/buxiasen; }
}
然后把对应的dns解析到nginx服务器 就可以了
后续补充
使用nginx可以实现不同的dns指向同一个ip之后、通过server进行分发到不同的ip跟端口、也可以实现301、302等的重定向。
weibo.buxiasen.com
blog.buxiasen.com
类似这种效果、
因为域名没有备案、貌似在阿里云没办法加301跟nginx。。。
所以选择了使用亚马逊的临时服务器作为nginx中转 好绕。。
sudo apt-get install nginx 之后
在/etc/nginx/site-enabled 文件夹内加入以下一段文本、文件名任意
server{
server_name blog.buxiasen.com www.buxiasen.com;
location / {
proxy_pass http://jaonbu.github.io; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
就实现了blog地址的重映射
放入以下文本就可以实现301
实现weibo的301重定向
server{
server_name weibo.buxiasen.com
location / {
return 301 http://weibo.com/buxiasen; }
}
然后把对应的dns解析到nginx服务器 就可以了
后续补充
相关文章推荐
- 搭建nginx+uwsgi+django环境
- nginx 负载均衡、用数据库存储Session,来实现多站点共享Session[转]
- 自动化管理工具Saltstack之nginx部署(12)
- 配置Nginx 1.8支持PHP 5.6
- 让Apache 和nginx支持跨域訪问
- Centos-6.7下Nginx-1.8.0安装过程详解
- Nginx对某个文件夹或整个站点进行登录认证的方法
- Linux-000-ubutun编译安装nginx
- Linux-001-nginx index 中文乱码
- nginx初级安装配置
- Win10上搭建Nginx+SimpleSAMLphp认证服务
- 在Nginx服务器上屏蔽IP的一些基本配置方法分享
- centos LB负载均衡集群 三种模式区别 LVS/NAT 配置 LVS/DR 配置 LVS/DR + keepalived配置 nginx ip_hash 实现长连接 LVS是四层LB 注意down掉网卡的方法 nginx效率没有LVS高 ipvsadm命令集 测试LVS方法 第三十三节课
- nginx 安装手记
- django-nginx-uwsgi
- PHP+PHP-fpm+PHP-cgi+nginx+yii2
- Nginx服务启动脚本
- nginx+keepalived双主高可用负载均衡
- 浅谈Nginx
- CentOS 6.7 编译安装Nginx 1.8.0