Friday, 15 March 2013

django - Setup pretty local development URLs with nginx on Mac OS X -



django - Setup pretty local development URLs with nginx on Mac OS X -

i have django server setup can access 127.0.0.1:8000

i have installed nginx on mac os x yosemite , can access 'welcome nginx' screen @ localhost:80

i want able set local development environment on local.ingledow.co.uk when visit url, redirects me live site: david.ingledow.co.uk.

i did have wildcard url forwarder dnsimple redirect this:

*.ingledow.co.uk > david.ingledow.co.uk

but have removed that.

i have added cname: local.ingledow.co.uk > 127.0.0.1

this shouldn't impact how setup local nginx servers.

so, how create nginx server on mac shows 127.0.0.1:8000 django project on custom domain (local.ingledow.co.uk).

this nginx setup:

default nginx config @ /usr/local/etc/nginx/nginx.conf #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 { hear 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 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 { hear 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; } }

i'm not sure if apache conflicting nginx? or whether i've setup nginx incorrectly?

setting cname registrar isn't going help @ all, , should remove that.

the way create work edit local hosts file @ /etc/hosts , add together pointer localhost:

127.0.0.1. local.ingledow.co.uk

then you'll either need run dev server on port 80 instead of 8000, or configure nginx run site via gunicorn or uwsgi - documentation tells how that.

django osx apache nginx dns

No comments:

Post a Comment