【发布时间】:2015-01-05 02:27:20
【问题描述】:
我有一个可以从 127.0.0.1:8000 访问的 Django 服务器设置
我刚刚在 Mac OS X Yosemite 上安装了 nginx,可以通过localhost:80访问“欢迎使用 nginx”屏幕
我希望能够在 local.ingledow.co.uk 上设置本地开发环境,但是当我访问该 URL 时,它会将我重定向到我的实时站点:david.ingledow.co.uk。
我确实有一个带有 DNSimple 的通配符 URL 转发器,它会像这样重定向:
*.ingledow.co.uk > david.ingledow.co.uk
但我已经删除了。
我已添加此 CNAME:local.ingledow.co.uk > 127.0.0.1
这不应该影响我设置本地 nginx 服务器的方式。
那么,如何在 Mac 上创建一个 nginx 服务器,将我的 127.0.0.1:8000 Django 项目显示到自定义域 (local.ingledow.co.uk)。
这是我的 nginx 设置:
/usr/local/etc/nginx/nginx.conf 中的默认 Nginx 配置
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
# INCLUDES
include /Users/dingledow/etc/nginx/*.conf;
}
ingledow.conf 位于 /Users/dingledow/etc/nginx/ingledow.conf
server {
listen 80;
server_name local.ingledow.co.uk;
location / {
root /Users/dingledow/Documents/Work/Ingledow/git/my_site2/;
index index.html index.htm index.php;
autoindex on;
}
}
我不确定 Apache 是否与 nginx 冲突?还是我刚刚设置的nginx不正确?
【问题讨论】:
标签: django macos apache nginx dns