You have the general procedure correct. The syntax for the command is below.
openssl req -new -key {private key file} -out {output file}
However, the warnings are displayed, because the browser was not able to verify the identify by validating the certificate with a known Certificate Authority (CA).
As this is a self-signed certificate there is no CA and you can safely ignore the warning and proceed. Should you want to get a real certificate that will be recognizable by anyone on the public Internet then the procedure is below.
I have more details about this in a post at Securing the Connection: Creating a Security Certificate with OpenSSL