nginx 301 域名跳转
2014-11-06 17:36
225 查看
假设两个域名 cai.com www.cai.com,需要把所有cai.com 的访问都跳转到 www.cai.com
server {
listen 80 ;
server_name _;
index index.html index.htm index.php;
root /alidata/www/;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
access_log /alidata/log/nginx/access/default.log;
}
server {
listen 80 default;
server_name www.cai.com;
index index.html index.htm index.php;
root /alidata/www/114/trunk/;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
access_log /alidata/log/nginx/access/114.log;
}
server {
server_name cai.com;
rewrite "^/(.*)" http://www.cai.com/$1 permanent;
}
server {
listen 80 ;
server_name _;
index index.html index.htm index.php;
root /alidata/www/;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
access_log /alidata/log/nginx/access/default.log;
}
server {
listen 80 default;
server_name www.cai.com;
index index.html index.htm index.php;
root /alidata/www/114/trunk/;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
access_log /alidata/log/nginx/access/114.log;
}
server {
server_name cai.com;
rewrite "^/(.*)" http://www.cai.com/$1 permanent;
}
相关文章推荐
- 【随笔】nginx下的301跳转,两个域名指向同一个服务器ip
- nginx域名301跳转设置、服务器IP地址禁止访问500设置
- Nginx服务器301跳转到带www的域名的方法
- nginx实现301域名跳转
- 如何实现301的跳转?当输入域名http://xxx.com的时候自动重定向到www上去
- nginx 域名跳转一例~~~(rewrite、proxy)
- 使用nginx进行裸域名的跳转
- nginx 域名跳转一例~~~(rewrite、proxy)
- nginx中配置域名跳转示例
- nginx 域名跳转 Nginx跳转自动到带www域名规则配置、nginx多域名向主域名跳转
- nginx虚拟主机和域名跳转
- Nginx 禁止IP访问及未绑定的域名跳转
- LNMP—Nginx的域名跳转
- 1.8-nginx域名跳转
- Nginx 禁止IP访问及未绑定的域名跳转
- nginx 域名rewrite跳转
- Apache的Rewrite设置多域名301跳转到主域名的方法
- nginx下的域名跳转
- nginx 禁止ip访问及未绑定的域名跳转
- Nginx 禁止IP访问及未绑定的域名跳转