Bertho Joris
Bertho Joris

Reputation: 1601

Yii application 404 not found with nginx server

I tried to run the yii application on my vps which is installed with nginx as a server. but when I access my domain: www.domain.com, pages appear fine but if one link is always accessed 404 not found error. Is there something wrong with my nginx settings?

My nginx configuration :

server {
listen       80;
server_name  www.mydomain.com;

   location / {
       root   /usr/share/nginx/html;
       index  index.php index.html index.htm;
   }

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

    location ~ \.php$ {
       root           /usr/share/nginx/html;
       fastcgi_pass   127.0.0.1:9000;
       fastcgi_index  index.php;
       fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       include        fastcgi_params;
   }

}

Upvotes: 1

Views: 2800

Answers (1)

Mohammad AbuShady
Mohammad AbuShady

Reputation: 42909

below the index line add this line

try_files $uri $uri/ /index.php$request_uri;

Upvotes: 1

Related Questions