我知道这类问题有现有的解决方案,但没有一个能解决我的问题
一旦我输入以 WWW 为前缀的网站,就会显示这样的 403 错误:
这是我的域解析设置:
这是我的CDN设置截图,我的服务器是阿里云。 CDN设置截图
这是我的 Nginx 配置截图:
如你所见,我配置了www.example.com
我example.com
的 Nginx,我还添加了 CDN CNAME 到www.example.com
,example.com
我可以访问example.com
但无法访问www.example.com
。
我 ping 了两个,它们都能正常响应,都是 CDN 域名地址,但是 IP 地址不同,下面是 ping 的截图
但是我无法www.example.com
通过浏览器访问,这太麻烦了。
顺便说一句,这是我的整个 Nginx 配置
mysite_nginx.conf
the upstream component nginx needs to connect to
upstream django_ {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8005; # for a web port socket (we'll use this first)
}
configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name www.labtine.com labtine.com # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /home/cg_log/CG_log/media; # your Django project's media files - amend as required
}
location /static {
alias /home/cg_log/CG_log/static; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass 127.0.0.1:8003;
include /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
}
}