Ранее пытался обновить Nginx с 1.14 до 1.14.1. Но в apt-get upgrade я получил:
mysite systemd[1]: Starting A high performance web server and a reverse proxy server...
mysite nginx[31861]: nginx: [emerg] duplicate upstream "fastcgi_backend" in /etc/nginx/sites-enabled/mysite.conf.save:1
mysite nginx[31861]: nginx: configuration file /etc/nginx/nginx.conf test failed
mysite systemd[1]: nginx.service: Control process exited, code=exited status=1
mysite systemd[1]: Failed to start A high performance web server and a reverse proxy server.
mysite systemd[1]: nginx.service: Unit entered failed state.
mysite systemd[1]: nginx.service: Failed with result 'exit-code'.
dpkg: error processing package nginx-full (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
nginx depends on nginx-full (<< 1.14.1-0+xenial0.1~) | nginx-light (<< 1.14.1-0+xenial0.1~) | nginx-extras (<< 1.14.1-0+xenial0.1~); however:
Package nginx-full is not configured yet.
Package nginx-light is not installed.
Package nginx-extras is not installed.
nginx depends on nginx-full (>= 1.14.1-0+xenial0) | nginx-light (>= 1.14.1-0+xenial0) | nginx-extras (>= 1.14.1-0+xenial0); however:
Package nginx-full is not configured yet.
Package nginx-light is not installed.
Package nginx-extras is not installed.
У меня есть в файле mysites.conf:
upstream fastcgi_backend {
server 127.0.0.1:9000;
#server unix:/run/php/php7.2-fpm.sock;
}
server {
listen 80;
server_name mysite.com;
return 301 https://www.example.com$request_uri;
}
server {
listen 80 default_server;
server_name www.example.com; # dev.www.example.com;
root /home/public_html;
#check http_x_forwarded_proto value that comes from load balancer
set $my_http "http";
set $my_ssl "off";
set $my_port "80";
if ($http_x_forwarded_proto = "https") {
set $my_http "https";
set $my_ssl "on";
set $my_port "443";
}
#cut off port from url
port_in_redirect off;
#setup log files
access_log /home/www_logs/access.log;
error_log /home/www_logs/error.log;
include includes/blocks.conf;
# Include Security rules for Mageto
include includes/security.conf;
# Tell browsers that website should olways be accessible via HTTPS
# add_header Strict-Transport-Security "max-age=15984000" always;
# Include redirects
include includes/redirects.conf;
# Include static
include includes/static.conf;
# Add rewrite for product feeds
location ~ ^/en/skroutzfeed\.xml {
expires 24h;
try_files /home/public_html/skroutzfeed_en.xml /skroutzfeed_en.xml =404;
}
location ~ ^/el/skroutzfeed\.xml {
expires 24h;
try_files /home/public_html/skroutzfeed_gr.xml /skroutzfeed_gr.xml =404;
}
location ~ ^/skroutzfeed\.xml {
expires 24h;
try_files /home/public_html/skroutzfeed_gr.xml /skroutzfeed_gr.xml =404;
}
#include includes/phpmyadmin.conf;
#include includes/solr.conf;
#location ~ ^/el {
# #set $magento_run_code "el";
# #set $magento_run_type "store";
#}
#location ~ ^/en {
# #set $magento_run_code "en";
# #set $magento_run_type "store";
#}
location / {
#expires 30d;
index index.html index.php;
set $magento_run_code "el";
set $magento_run_type "store";
try_files $uri $uri/ @handler;
}
location @handler {
rewrite / /index.php;
}
#location = /js/index.php/x.js {
# rewrite ^(.*\.php)/ $1 last;
#}
location ~ \.php {
expires off;
# fastcgi_pass fastcgi_backend;
fastcgi_buffers 8 32k;
fastcgi_buffer_size 64k;
fastcgi_busy_buffers_size 64k;
fastcgi_connect_timeout 3000s;
fastcgi_read_timeout 3000s;
fastcgi_send_timeout 3000s;
fastcgi_param HTTPS $my_ssl;
fastcgi_param REMOTE_ADDR $http_x_real_ip;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param REMOTE_ADDR $http_x_real_ip;
}
}
Как я проверял, у меня есть только эти строки:
upstream fastcgi_backend {
server 127.0.0.1:9000;
#server unix:/run/php/php7.2-fpm.sock;
}
Я сломал свой сайт. Кто-нибудь может помочь?
У вас upstream fastcgi_backend
определяется дважды: в mysites.conf
И в wallpapershop.gr.conf.save
. Следовательно, вы получили сообщение об ошибке nginx: [emerg] duplicate upstream "fastcgi_backend"
.
Удалив второй файл конфигурации (по совету Майкла Хэмптона), вы решили проблему.