self-signed SSL certificate<\/a> is a good option to choose when you are trying or testing things out on your Apache server. While your personal certificate won\u2019t mean anything to browsers, and visitors will still get a warning message if they visit your site directly, you can at least be sure that you\u2019re protected against \u201cman-in-the-middle\u201d attacks. If you already have a paid SSL certificate, you can skip this step and continue.<\/p>\r\n\r\n\r\n\r\nRun this command to generate a self-signed SSL certificate.<\/p>\r\n\r\n\r\n\r\n
$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout \/etc\/ssl\/private\/server.yourdomain.com.key -out \/etc\/ssl\/certs\/server.yourdomain.com.crt<\/pre>\r\n\r\n\r\n\r\nWhen running the command above, you will need to answer the prompts.<\/p>\r\n\r\n\r\n\r\n
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:
Email Address []:<\/pre>\r\n\r\n\r\n\r\nMake sure you type the domain\/subdomain you want to install the SSL certificate for. For instance, you can type server.yourdomain.com<\/p>\r\n\r\n\r\n\r\n
The command above will store the private key at \/etc\/ssl\/private\/server.yourdomain.com.key and the certificate file at \/etc\/ssl\/certs\/server.yourdomain.com.crt<\/p>\r\n\r\n\r\n\r\n\r\n\r\n