espressobeanmachine
January 20th, 2021, 03:32 PM
I want to get a Let's Encrypt SSL certificate but I am getting an error in my syntax.
OS: Ubuntu 20.04
Webserver: NGiNX 1.18
web configuration:
server {
listen 443;# ssl http2;
listen [::]:443;# ssl http2;
server_name nextcloud.domain.com;
root /var/www/nextcloud.domain.com;
# SSL
#;#ssl_certificate /etc/letsencrypt/live/nextcloud.domain.com/fullchain.pem;
#;#ssl_certificate_key /etc/letsencrypt/live/nextcloud.domain.com/privkey.pem;
#;#ssl_trusted_certificate /etc/letsencrypt/live/nextcloud.domain.com/chain.pem;
# security
include nginxconfig.io/security.conf;
# logging
access_log /var/log/nginx/nextcloud.domain.com.access.log;
error_log /var/log/nginx/nextcloud.domain.com.error.log warn;
# index.php fallback
location ~ ^/api/ {
try_files $uri $uri/ /index.php?$query_string;
}
# reverse proxy
location / {
proxy_pass http://192.168.7.204;
include nginxconfig.io/proxy.conf;
}
}
# HTTP redirect
server {
listen 80;
listen [::]:80;
server_name nextcloud.domain.com;
include nginxconfig.io/letsencrypt.conf;
location / {
return 301 https://nextcloud.domain.com$request_uri;
}
}
I ran the command to comment out the SSL directives:
sed -i -r 's/(listen .*443)/\1;#/g; s/(ssl_(certificate|certificate_key|trusted_certific ate) )/#;#\1/g' /etc/nginx/conf.d/nextcloud.domain.com.conf
but running nginx -t i get the following error:
root@nginx:/etc/nginx/conf.d# nginx -t
nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/conf.d/nextcloud.domain.com.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
What am I doing wrong?
OS: Ubuntu 20.04
Webserver: NGiNX 1.18
web configuration:
server {
listen 443;# ssl http2;
listen [::]:443;# ssl http2;
server_name nextcloud.domain.com;
root /var/www/nextcloud.domain.com;
# SSL
#;#ssl_certificate /etc/letsencrypt/live/nextcloud.domain.com/fullchain.pem;
#;#ssl_certificate_key /etc/letsencrypt/live/nextcloud.domain.com/privkey.pem;
#;#ssl_trusted_certificate /etc/letsencrypt/live/nextcloud.domain.com/chain.pem;
# security
include nginxconfig.io/security.conf;
# logging
access_log /var/log/nginx/nextcloud.domain.com.access.log;
error_log /var/log/nginx/nextcloud.domain.com.error.log warn;
# index.php fallback
location ~ ^/api/ {
try_files $uri $uri/ /index.php?$query_string;
}
# reverse proxy
location / {
proxy_pass http://192.168.7.204;
include nginxconfig.io/proxy.conf;
}
}
# HTTP redirect
server {
listen 80;
listen [::]:80;
server_name nextcloud.domain.com;
include nginxconfig.io/letsencrypt.conf;
location / {
return 301 https://nextcloud.domain.com$request_uri;
}
}
I ran the command to comment out the SSL directives:
sed -i -r 's/(listen .*443)/\1;#/g; s/(ssl_(certificate|certificate_key|trusted_certific ate) )/#;#\1/g' /etc/nginx/conf.d/nextcloud.domain.com.conf
but running nginx -t i get the following error:
root@nginx:/etc/nginx/conf.d# nginx -t
nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/conf.d/nextcloud.domain.com.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
What am I doing wrong?