E
E
Evgeny Romashkan2018-02-23 11:47:03
Nginx
Evgeny Romashkan, 2018-02-23 11:47:03

Why is there a 404 nginx error?

I downloaded the site sources from this article https://habrahabr.ru/post/150267/#Result ( https://github.com/vitalyswipe/tinymvc/zipball/v0.1)
I tried to install it on my local server with nginx and php -fpm
When you try to go to any page except the main one, an error 404 not found appears
. I did not change anything in the nginx config. Site config:

server {
  listen 80;
  listen [::]:80;

  server_name visit.ru;

  root /home/evgeniy/mysites/visit.ru;

  index index.php;

  location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;
  }

  # pass PHP scripts to FastCGI server
  #
  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
  
  #	# With php-fpm (or other unix sockets):
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
  #	# With php-cgi (or other tcp sockets):
  #	fastcgi_pass 127.0.0.1:9000;
  }

  # deny access to .htaccess files, if Apache's document root
  # concurs with nginx's one
  #
  #location ~ /\.ht {
  #	deny all;
  #}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2018-02-23
@EvgeniiR

try_files $uri $uri/ /index.php?$args;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question