问个nginx 配置里面的 域名跳转301 问题

问个nginx 配置里面的 域名跳转301 问题

问个nginx 配置里面的 域名跳转301 问题

想把www.qqq.com 全部永久301重定向到 www.aaa.com
下面是我的nginx里面的配置。我下面的代码不成功。不知道正确的怎么实现呢?

server {

listen 443 ssl;

server_name www.qqq.com qqq.com;

ssl_certificate 1_www.qqq.com_bundle.crt;

ssl_certificate_key 2_www.qqq.com.key;

ssl_session_timeout 5m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;

ssl_prefer_server_ciphers on;

charset UTF-8;

client_max_body_size 75M;

fastcgi_buffers 8 128k;

fastcgi_busy_buffers_size 128k;

location / {

include uwsgi_params;

uwsgi_pass 127.0.0.1:12008;

uwsgi_send_timeout 300;

uwsgi_connect_timeout 300;

uwsgi_read_timeout 300;

}

location /static {

expires 30d;

autoindex on;

#return 403;

add_header Cache-Control private;

alias /www/www/html/qqq/static/;

}

location /media {

expires 30d;

autoindex on;

#return 403;

add_header Cache-Control private;

alias /www/www/html/qqq/media/;

}

}

erver{

listen 80;

server_name www.qqq.com qqq.com;

rewrite ^(.*) https://www.aaa.com$1 permanent;

}


回答:

为什么我没有看到你https的去做 rewrite?

而且应该是 server你少了个字母。

    server {

listen 80;

server_name lilnong.top;

rewrite ^/(.*)$ https://www.lilnong.top/$1 permanent;

}

以上是 问个nginx 配置里面的 域名跳转301 问题 的全部内容, 来源链接: utcz.com/a/158358.html

回到顶部