将www.DOMAIN重定向至带有Ghost和CloudFlare的https://domain

au9on6nz  于 2022-10-06  发布在  Nginx
关注(0)|答案(0)|浏览(152)

我在WWW上迷失到了非WWW路由。我看到人们发布了很多代码块之类的东西,而我还没有为nginx编写任何代码。ghost有一个Ubuntu设置指南和一个CLI,它可以在其中为您设置nginx。现在,除了https://www.example.com显示:

之外,https://、http://和example.com都连接到我的域

我怎么做才能使WWW也重定向到https://?我没有在nginx中做任何事情,这是为我做的,所以如果你需要我给你展示设置或编辑特定的文件,请让我知道。

如果这与我的域名服务提供商有关,我现在正在使用CloudFlare,所以如果有什么需要做的,也请让我知道,谢谢!

这是我的nginx.conf文件

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

# mail {

# # See sample authentication script at:

# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript

# 

# # auth_http localhost/auth.php;

# # pop3_capabilities "TOP" "USER";

# # imap_capabilities "SOMETHING" "SOMETHING";

# 

# server {

# listen     localhost:110;

# protocol   pop3;

# proxy      on;

# }

# 

# server {

# listen     localhost:143;

# protocol   imap;

# proxy      on;

# }

# }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题