我遇到了以下问题,我可以使用我的根域“www.domain.com”连接到我的 seafile 安装,尽管我只指定了并且只想使用“cloud.domain.com”。我只能访问一个服务器 IP,也许这就是问题所在?
访问“www.domain.com”不会将我重定向到子域,它只是在根域上打开一个会话。
我的 A 记录设置如下:
- www.domain.com > 服务器IP1
- domain.com > 服务器IP1
- cloud.domain.com > serverIP1
我的nginx.conf:
server {
listen 80;
server_name cloud.domain.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/cacert.pem;
ssl_certificate_key /etc/ssl/privkey.pem;
ssl_prefer_server_ciphers on;
server_name cloud.domain.com;
location / {
fastcgi_pass 127.0.0.1:8000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS on;
fastcgi_param HTTP_SCHEME https;
access_log /var/log/nginx/seahub.access.log;
error_log /var/log/nginx/seahub.error.log;
}
location /media {
root /root/cloud/seafile-server-1.7.0.2/seahub;
}
}