ngnix 作爲django項目的web服務器

鉤子:       

          How To Install Nginx on Ubuntu 14.04 LTS


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 
         # 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
        }
3. sudo nginx -t (查看nginx語法,並返回詳細錯誤)

   sudo nginx -h (不懂就查)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章