Nginx: Falha ao iniciar Um servidor da web de alto desempenho e um servidor proxy reverso

3

Recentemente, tentei instalar o certificado letsencrypt, mas não consegui iniciar o nginx novamente. quando executo o status nginx do serviço de comando. Eu recebo esta mensagem de erro

 nginx.service - A high performance web server and a reverse proxy server
 Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: 
enabled)
Active: failed (Result: exit-code) since Tue 2018-02-20 16:17:49 CET; 8min 
ago
Process: 1439 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; 
master_process on; (code=exited, status=1/FAILURE)

Feb 20 16:17:47 django-s-1vcpu-1gb-lon1-01 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 nginx[1439]: nginx: [emerg] "location" directive is not allowed here in /etc/nginx/nginx.conf:87
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 nginx[1439]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 systemd[1]: nginx.service: Control process exited, code=exited status=1
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 systemd[1]: nginx.service: Unit entered failed 
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 systemd[1]: nginx.service: Failed with result 'exit-code'.

E aqui está o / etc / nginx / sites-avalible / django

upstream app_server {
server unix:/home/django/gunicorn.socket fail_timeout=0;
}

server {
#listen 80 default_server;
#listen [::]:80 default_server ipv6only=on;

listen 443 ssl;
server_name nettside.no;
ssl_certificate /etc/letsencrypt/live/nettside.no/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/nettside.no/privkey.pem;

root /usr/share/nginx/html;
index index.html index.htm;

client_max_body_size 4G;
server_name nettside.no;

keepalive_timeout 5;

# Your Django project's media files - amend as required
location /media  {
    alias /home/django/django_project/django_project/media;
}

# your Django project's static files - amend as required
location /static {
    alias /home/django/django_project/static;
}

# Proxy the static assests for the Django Admin panel
location /static/admin {
   alias /home/django/django_project/static/admin;

}

   location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
        proxy_buffering off;

        proxy_pass http://app_server;
}

}

server {
    listen 80;
    server_name nettside.no;
    return 301 https://$host$request_uri;
}

Obrigado pela ajuda.

    
por ranjith 20.02.2018 / 16:35

0 respostas