Yii 2.0 getting 404 Error after installing Yii

I’ve installed Nginx, php-fpm and mariadb by this tutorial. but I chose php version 7 instead of 5.

After this I copied the web app to /var/www/default/. First I got some DB errors which I resolved. Now I’m getting a 404 Not Found error on the site I want to open.
http://localhost is forwarding to http://localhost/site/login which throws the 404. I tried localhost?r=site/login and it is also forwarding to /site/login.

Here some informations:
PHP 7.0.27
Nginx 1.13.9
Maria DB 10.2.13
Yii 2.0


server {
listen 80;
server_name localhost;
root /var/www/default/app;

access_log /usr/local/etc/nginx/logs/default.access.log main;

location / {
    index  index.html $yii_bootstrap;
    try_files $uri $uri/ /index.php$request_uri;

location ~ \.php$ {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

location = /info {
deny all;
rewrite (.*) /.info.php;

# phpmyadmin
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
fastcgi_intercept_errors on;
root /usr/local/share/;
fastcgi_index index.php;
include fastcgi_params;

error_page 404 /404.html;
error_page 403 /403.html;

Any suggestions to solve this error?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s