F
F
fedorenko_k2015-07-27 19:32:22
Nginx
fedorenko_k, 2015-07-27 19:32:22

Laravel + nginx bundle?

Good afternoon. Switched from Apache to nginx (using the isp panel).
Now all laravel pages give errors (404 not found [nginx]).
How do I set up the old .htaccess file? They say that it does not work at all in nginx, but I inserted the following information into it:

# nginx configuration
location / {
rewrite ^/(.*)/$ /$1 redirect;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mikhail Osher, 2015-07-27
@miraage

laravel.com/docs/5.1/installation

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

E
evnuh, 2015-07-27
@evnuh

In .htaccess, you can now also write your pedigree and insert photos of the cat, because you no longer need it (file).
The nginx configuration files are usually located in /etc/nginx/sites-available
there and add your configurations

R
Roman, 2016-10-05
@kublahanov

I would like to add to the topic starter's question.
Is there a more complete nginx config for Laravel somewhere?
Like this for Symfony, for example:
symfony.com/doc/current/setup/web_server_configura...
Although for Symfony (and some others) there is the same config description even in the Nginx documentation, but for Laravel for some reason nothing no:
https://www.nginx.com/resources/wiki/start/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question