nginx : PrettyUrl doent work (Yii2)

Maulik patel maulikpatelbtech at
Sun Oct 15 14:16:25 UTC 2017

Hi Team,

You are doing Great Job. Just i need a small solution from you guys.

I have installed nginx server and i set for backend 'enablePrettyUrl' =>

Below are the my default.conf file

server {
    listen   80;
    server_name  SERVER_IP;

    # note that these lines are originally from the "location /" block
    root   /usr/share/nginx/html;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ =404;

    error_page 404 /errors/404.html;
    error_page 500 502 503 504 /errors/50x.html;
    location = /errors/50x.html {
        root /usr/share/nginx/html;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

When i run http://SERVER_IP/backend/web/CONTROLLER_NAME
<http://server_ip/backend/web/CONTROLLER_NAME> Its redirect to me in 404
error page.

Can you please tell me how to enable pretty url in yii2 with nginx
configuration? Please note that there is static website so my root path
will be /usr/share/nginx/html



Your regards,
Maulik Patel
Phone    : +91-942-935-9528
Skype    : maulikpatelbtech
LinkedIn :
Stack      :
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list