好了,我是一个网站新手,刚刚完成了django教程,并决定尝试在网上发布我的投票应用程序。到目前为止,我有一个godaddy域名,我试图将它指向我的亚马逊EC2实例的弹性IP,该IP目前托管着我的投票网站。
目前我设置的是:
亚马逊路由53:指向mydomain.com的托管区域,记录集为: name mydomain.com & www.mydomain.com和Value xx.xxx.xx.x
DNS专区文件:a(主机)到我的amazon弹性IP xx.xxx.xx.x,名称服务器到4个amazon route 53托管区域名称服务器。
EC2实例:运行nginx和gunicorn托管应用。
我的问题是,我可以用亚马逊的弹性IP访问网站,但不能用域名访问(我得到了一个粗体的"Welcome to nginx!“页面,无论我是尝试转到主页还是/polls/1页面。)
发布于 2014-02-11 08:17:15
看起来差不多了。你有没有使用nginx遵循标准的gunicorn配置?
http://docs.gunicorn.org/en/latest/deploy.html
您可能需要在nginx配置中使用类似以下内容:
http {
include mime.types;
default_type application/octet-stream;
access_log /tmp/nginx.access.log combined;
sendfile on;
upstream app_server {
server unix:/tmp/gunicorn.sock fail_timeout=0;
# For a TCP configuration:
# server 192.168.0.7:8000 fail_timeout=0;
}
server {
listen 443 default;
client_max_body_size 4G;
server_name _;
ssl on;
ssl_certificate /usr/local/nginx/conf/cert.pem;
ssl_certificate_key /usr/local/nginx/conf/cert.key;
keepalive_timeout 5;
# path for static files
root /path/to/app/current/public;
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /path/to/app/current/public;
}
}
}您希望指向正确的SSL证书和密钥路径(而不是/usr/local/nginx/conf/cert.pem;和/usr/local/nginx/conf/cert.key;)。此外,您应该将根目录指向特定的Django静态文件,而不是/path/to/app/current/public
发布于 2014-02-12 07:11:56
好了,我想通了。
Nginx正在收听127.0.0.1:8000,gunicorn正在收听127.0.0.1:8001。(502错误)
为了解决DNS问题,我不得不打开我的amazon EC2控制面板,打开8000端口。
https://stackoverflow.com/questions/21690203
复制相似问题