【发布时间】:2015-05-28 23:08:14
【问题描述】:
这种情况有点难以描述。我使用 nginx 和 uwsgi 将我的 Django 博客部署在我的 VPS 上,它运行良好,但我只能使用我的 IP 来访问应用程序,我如何在没有 www 的情况下使用我的域来设置我的应用程序?我设置了server_namebreakwire.me并设置了一条A记录HOST是'@',指向我的VPS的IP,但是如果我访问breakwire.me,我只能看到
“欢迎使用 nginx”
这是我的 nginx 配置文件
# my_blog__nginx.conf
# configuration of the server
server {
the port your site will be served on
listen 106.186.29.228:8000;
# the domain name it will serve for
server_name breakwire.me; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# logs
access_log /home/chen/DjangoProjects/my_blog/logs/access.log;
error_log /home/chen/DjangoProjects/my_blog/logs/error.log;
# Django media
location /media {
alias /home/chen/DjangoProjects/my_blog/media; # your Django project's media files - amend as required
}
location /static {
alias /home/chen/DjangoProjects/my_blog/static; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass 106.186.29.228:8001;
include /home/chen/DjangoProjects/my_blog/uwsgi_params; # the uwsgi_params file you installed
}
}
【问题讨论】: