Linux - https - how to generate self-signed certificate
Hello, I need to generate a self-signed certificate on Linux for HTTPS access to my nextcloud. I do not mind that the certificate will be untrustworthy. Please proceed as quickly as possible. Thank you
Hello,
to generate a self-signed certificate for https would be like this:
1.) Generated a certificate for 10 years
2.) Generate dhparam.pem
3.) Set up virtualhost for webserver, here for nginx:
REPLY
Hello,
to generate a self-signed certificate for https would be like this:
1.) Generated a certificate for 10 years
openssl req -x509 -nodes -days 3650 -newkey rsa: 2048 -keyout /etc/ssl/certs/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
2.) Generate dhparam.pem
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
3.) Set up virtualhost for webserver, here for nginx:
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
root /var/www/myweb;
index index.php index.html;
server_name cloud.up4.cz;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/certs/nginx-selfsigned.key;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}