nginx.conf中对django的设置。

问题描述 投票:0回答:1

在我的ubuntu服务器上,我将设置nginx.conf与我的django应用程序一起工作,我设置nginx.conf文件,像这样。

user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    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  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;

    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    index   index.html index.htm;

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  34.233.212.246;
        root         /usr/share/nginx/html;
        #root           /home/ec2-user/carrera/podium/static;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
            proxy_pass http://127.0.0.1:8000;
            #proxy_set_header X-Forwarded-Host $server_name;
            #proxy_set_header X-Real-IP $remote_addr;
            add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
            add_header P3P 'policyref="/w3c/p3p.xml", CP="IDC DSP COR ADM DEVi TAIi PSA PSD $
        }

        # redirect server error pages to the static page /40x.html
        #
        error_page 404 /404.html;
        location = /40x.html {
        }

        # redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }

}

但当我运行服务时,服务器返回了这个错误:"unexpected end of file, expecting ";" or "}" in etc:

意外的文件结尾,在etcng$中期待"; "或"}"。

档尾

有谁能帮我一下好吗?

所以先谢谢你了

django nginx ubuntu-server
1个回答
0
投票

在位置下面有一行。

add_header P3P 'policyref="w3cp3p.xml", CP="IDC DSP COR ADM DEVi TAIi PSA PSD $。

这一行没有以分号(;)结束。这可能是原因?

© www.soinside.com 2019 - 2024. All rights reserved.