ngnix 作為django專案的web伺服器
阿新 • • 發佈:2019-01-27
鉤子:
1. sudo vi /etc/nginx/nginx.conf ##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
2. sudo vi /etc/nginx/sites-enabled/default
3. sudo nginx -t (檢視nginx語法,並返回詳細錯誤) sudo nginx -h (不懂就查)# Make site accessible from http://localhost/ #server_name localhost; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. proxy_pass http://127.0.0.1:8000; proxy_set_header X-Real-IP $remote_addr; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; #try_files $uri $uri/ =404; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules }