Reputation: 21
Two PHP Phalcons are installed on the website:
Part of nginx.conf:
server {
listen 80;
server_name example.com;
root /home/srv/http/example.com/public;
index index.php;
access_log off;
error_log /var/log/nginx/example.com_error.log;
location / {
root /home/srv/http/example.com/public;
try_files $uri $uri/ /index.php?_url=$uri&$args;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/srv/http/example.com/public$fastcgi_script_name;
include fastcgi_params;
}
location /admin {
root /home/srv/http/example.com/admin/public;
}
location ~ /admin/.+\.php$ {
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/srv/http/example.com/admin/public$fastcgi_script_name;
include fastcgi_params;
}
}
Previously, the apache was installed. And website and admin folder worked.
And now I replaced apache by nginx.
Website http://example.com work. But http://example.com/admin does not work, error 404.
Tell me please, what I'm doing wrong?
Upvotes: 1
Views: 50
Reputation: 1369
You are missing try files directive:
try_files $uri $uri/ /index.php?_url=$uri&$args;
Upvotes: 1