Nginx: не удалось запустить высокопроизводительный веб-сервер и обратный прокси-сервер

Недавно я попытался установить сертификат letencrypt, но я больше не мог запускать nginx. когда я запускаю статус службы nginx службы сервиса. Я получаю это сообщение об ошибке

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'.

И здесь / 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; }

Спасибо за помощь.

3
задан 20 February 2018 в 19:35

0 ответов

Другие вопросы по тегам:

Похожие вопросы: