How to get clean urls

I am quoting the guide:

Depending on the urlManager configuration, the created URL may look like one of the following (or other format). And if the created URL is requested later, it will still be parsed back into the original route and query parameter value.




I am interested in third option or second without index.php. But how can I get it ?

I have .htaccess that is removing index.php ( I may need something for nginx, but do not know what and how, I have never used it).

And I have pretty url set:

'urlManager' => [

    'enablePrettyUrl' => true,

    'showScriptName' => false,


what is next ?