Support intro
Nextcloud installation on raspi as mentioned here
https://canox.net/2016/06/die-eigene-cloud-mit-dem-raspberry-pi-und-nextcloud/
After stopping nginx to renew a certificate via certbot I can’t restart it. I am getting errors although I didn’t touch /etc/nginx/sites-enabled/default
Nextcloud version: 18.0.6
Operating system and version: Debian 10 „Buster“
Nginx version: 1.14.2
PHP version: 7.3
The issue you are facing:
After stopping nginx to renew a certificate via certbot I can’t restart it. I am getting errors although I didn’t touch /etc/nginx/sites-enabled/default
Any help/hint whatsoever ist greatly appreciated.
Is this the first time you’ve seen this error? Y
Steps to replicate it:
- sudo systemctl start nginx.service
–> Job for nginx.service failed because the control process exited with error code.
See “systemctl status nginx.service” and “journalctl -xe” for details.
This is my /etc/nginx/sites-enabled/default
upstream php-handler {
#server 127.0.0.1:9000;
server unix:/var/run/php/php7.3-fpm.sock;
}
server {
listen 80;
listen [::]:80;
server_name dieagentur.sel****;
# enforce https
#return 301 https://$server_name$request_uri;
root /var/www/html/;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name dieagentur.sel***;
ssl_certificate /etc/letsencrypt/live/dieagentur.sel***/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/dieagentur.self***/privkey.pem;
root /var/www/html/;
# Add headers to serve security related headers
# Before enabling Strict-Transport-Security headers please read into this
# topic first.
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
#
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy "no-referrer" always;
add_header X-Frame-Options “SAMEORIGIN”;
fastcgi_hide_header X-Powered-By;
# Path to the root of your installation root /var/www/html/;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
# The following rule is only needed for the Social app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/webfinger /public.php?service=webfinger last;
location = /.well-known/carddav {
return 301 $scheme://$host:$server_port/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host:$server_port/remote.php/dav;
}
# set max upload size
client_max_body_size 512M;
fastcgi_buffers 64 4K;
# Enable gzip but do not remove ETag headers
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
# Uncomment if your server is build with the ngx_pagespeed module
# This module is currently not supported.
#pagespeed off;
location / {
rewrite ^ /index.php;
}
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
deny all;
}
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) {
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param HTTPS on;
# Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
# Enable pretty urls
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
try_files $uri/ =404;
index index.php;
}
# Adding the cache control header for js, css and map files
# Make sure it is BELOW the PHP block
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463";
# Add headers to serve security related headers (It is intended to
# have those duplicated to the ones above)
# Before enabling Strict-Transport-Security headers please read into
# this topic first.
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
#
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
# Optional: Don't log access to assets
access_log off;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
try_files $uri /index.php$request_uri;
# Optional: Don't log access to other assets
access_log off;
}
}
The output of systemctl status nginx.service:
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en
Active: failed (Result: exit-code) since Thu 2020-09-10 10:27:30 BST; 57s ago
Docs: man:nginx(8)
Process: 7682 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process
Sep 10 10:27:30 raspberrypi systemd[1]: Starting A high performance web server a
Sep 10 10:27:30 raspberrypi nginx[7682]: nginx: [emerg] "upstream" directive is
Sep 10 10:27:30 raspberrypi nginx[7682]: nginx: configuration file /etc/nginx/ng
Sep 10 10:27:30 raspberrypi systemd[1]: nginx.service: Control process exited, c
Sep 10 10:27:30 raspberrypi systemd[1]: nginx.service: Failed with result 'exit-
Sep 10 10:27:30 raspberrypi systemd[1]: Failed to start A high performance web s
lines 1-12/12 (END)...skipping...
● 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 Thu 2020-09-10 10:27:30 BST; 57s ago
Docs: man:nginx(8)
Process: 7682 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Sep 10 10:27:30 raspberrypi systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 10 10:27:30 raspberrypi nginx[7682]: nginx: [emerg] "upstream" directive is not allowed here in /etc/nginx/sites-enabled/default.save:9
Sep 10 10:27:30 raspberrypi nginx[7682]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 10 10:27:30 raspberrypi systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Sep 10 10:27:30 raspberrypi systemd[1]: nginx.service: Failed with result 'exit-code'.
Sep 10 10:27:30 raspberrypi systemd[1]: Failed to start A high performance web server and a reverse proxy server.
The output of “journalctl -xe”:
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit nginx.service has begun execution.
--
-- The job identifier is 11092.
Sep 10 10:27:30 raspberrypi nginx[7682]: nginx: [emerg] "upstream" directive is not allowed here in /etc/nginx/sites-enabled/default.save:9
Sep 10 10:27:30 raspberrypi nginx[7682]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 10 10:27:30 raspberrypi systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStartPre= process belonging to unit nginx.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Sep 10 10:27:30 raspberrypi systemd[1]: nginx.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Sep 10 10:27:30 raspberrypi systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: A start job for unit nginx.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit nginx.service has finished with a failure.
--
-- The job identifier is 11092 and the job result is failed.
Sep 10 10:27:30 raspberrypi sudo[7675]: pam_unix(sudo:session): session closed for user root
Sep 10 10:27:31 raspberrypi kernel: Under-voltage detected! (0x00050005)
Sep 10 10:27:36 raspberrypi kernel: Voltage normalised (0x00000000)
Sep 10 10:27:47 raspberrypi rngd[364]: stats: bits received from HRNG source: 620064
Sep 10 10:27:47 raspberrypi rngd[364]: stats: bits sent to kernel pool: 573312
Sep 10 10:27:47 raspberrypi rngd[364]: stats: entropy added to kernel pool: 573312
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2 successes: 31
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2 failures: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Monobit: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Poker: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Runs: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Long run: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Continuous run: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: HRNG source speed: (min=735.529; avg=883.379; max=902.136)Kibits/s
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS tests speed: (min=3.859; avg=8.017; max=11.089)Mibits/s
Sep 10 10:27:47 raspberrypi rngd[364]: stats: Lowest ready-buffers level: 2
Sep 10 10:27:47 raspberrypi rngd[364]: stats: Entropy starvations: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: Time spent starving for entropy: (min=0; avg=0.000; max=0)us
Sep 10 10:28:48 raspberrypi kernel: Under-voltage detected! (0x00050005)
Sep 10 10:28:53 raspberrypi kernel: Voltage normalised (0x00000000)
lines 2624-2673/2673 (END)
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit nginx.service has begun execution.
--
-- The job identifier is 11092.
Sep 10 10:27:30 raspberrypi nginx[7682]: nginx: [emerg] "upstream" directive is not allowed here in /etc/nginx/sites-enabled/default.save:9
Sep 10 10:27:30 raspberrypi nginx[7682]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 10 10:27:30 raspberrypi systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStartPre= process belonging to unit nginx.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Sep 10 10:27:30 raspberrypi systemd[1]: nginx.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Sep 10 10:27:30 raspberrypi systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: A start job for unit nginx.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit nginx.service has finished with a failure.
--
-- The job identifier is 11092 and the job result is failed.
Sep 10 10:27:30 raspberrypi sudo[7675]: pam_unix(sudo:session): session closed for user root
Sep 10 10:27:31 raspberrypi kernel: Under-voltage detected! (0x00050005)
Sep 10 10:27:36 raspberrypi kernel: Voltage normalised (0x00000000)
Sep 10 10:27:47 raspberrypi rngd[364]: stats: bits received from HRNG source: 620064
Sep 10 10:27:47 raspberrypi rngd[364]: stats: bits sent to kernel pool: 573312
Sep 10 10:27:47 raspberrypi rngd[364]: stats: entropy added to kernel pool: 573312
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2 successes: 31
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2 failures: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Monobit: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Poker: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Runs: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Long run: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Continuous run: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: HRNG source speed: (min=735.529; avg=883.379; max=902.136)Kibits/s
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS tests speed: (min=3.859; avg=8.017; max=11.089)Mibits/s
Sep 10 10:27:47 raspberrypi rngd[364]: stats: Lowest ready-buffers level: 2
Sep 10 10:27:47 raspberrypi rngd[364]: stats: Entropy starvations: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: Time spent starving for entropy: (min=0; avg=0.000; max=0)us
Sep 10 10:28:48 raspberrypi kernel: Under-voltage detected! (0x00050005)
Sep 10 10:28:53 raspberrypi kernel: Voltage normalised (0x00000000)
~
~
~
~
lines 2624-2673/2673 (END)
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit nginx.service has begun execution.
--
-- The job identifier is 11092.
Sep 10 10:27:30 raspberrypi nginx[7682]: nginx: [emerg] "upstream" directive is not allowed here in /etc/nginx/sites-enabled/default.save:9
Sep 10 10:27:30 raspberrypi nginx[7682]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 10 10:27:30 raspberrypi systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStartPre= process belonging to unit nginx.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Sep 10 10:27:30 raspberrypi systemd[1]: nginx.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Sep 10 10:27:30 raspberrypi systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: A start job for unit nginx.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit nginx.service has finished with a failure.
--
-- The job identifier is 11092 and the job result is failed.
Sep 10 10:27:30 raspberrypi sudo[7675]: pam_unix(sudo:session): session closed for user root
Sep 10 10:27:31 raspberrypi kernel: Under-voltage detected! (0x00050005)
Sep 10 10:27:36 raspberrypi kernel: Voltage normalised (0x00000000)
Sep 10 10:27:47 raspberrypi rngd[364]: stats: bits received from HRNG source: 620064
Sep 10 10:27:47 raspberrypi rngd[364]: stats: bits sent to kernel pool: 573312
Sep 10 10:27:47 raspberrypi rngd[364]: stats: entropy added to kernel pool: 573312
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2 successes: 31
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2 failures: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Monobit: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Poker: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Runs: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Long run: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS 140-2(2001-10-10) Continuous run: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: HRNG source speed: (min=735.529; avg=883.379; max=902.136)Kibits/s
Sep 10 10:27:47 raspberrypi rngd[364]: stats: FIPS tests speed: (min=3.859; avg=8.017; max=11.089)Mibits/s
Sep 10 10:27:47 raspberrypi rngd[364]: stats: Lowest ready-buffers level: 2
Sep 10 10:27:47 raspberrypi rngd[364]: stats: Entropy starvations: 0
Sep 10 10:27:47 raspberrypi rngd[364]: stats: Time spent starving for entropy: (min=0; avg=0.000; max=0)us
Sep 10 10:28:48 raspberrypi kernel: Under-voltage detected! (0x00050005)
Sep 10 10:28:53 raspberrypi kernel: Voltage normalised (0x00000000)
~
~
~
~
~
The output of your Apache/nginx/error log in /var/log/nginx/error.log
:
2020/09/10 10:27:30 [emerg] 7682#7682: "upstream" directive is not allowed here in /etc/nginx/sites-enabled/default.save:9