This is something I always have to look up:

openssl req -nodes -newkey rsa:2048 -keyout server.key -subj "/CN=example.com" -out server.csr