Laravel on nginx (VPS)



Hello there!

I’m trying to use the Laravel on nginx. I have a VPS and I put the Laravel framework inside the root path of user (/home/vi360/) and the public path is on /home/vi360/

I’ve been researching several ways to set up nginx for laravel, but I’m not getting any success. Only the home page is opening (, but all the other pages (directed by /home/vi360/app/routes.php) are returning with error 404.

I have created the /home/vi360/nginx/ as follow:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /home/vi360/;
    index index.php index.html index.htm;

    server_name [server ip address];

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

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

What maybe am I doing wrong?

Ps.: Yes, on the Apache it’s working well, but I want to try on the nginx for any reasons.[/code]


I haven’t checked your code, but one quick suggestion: did you restart nginx after the changes to the conf file? See


Yes, always when I change the .conf file, I restart the VPS via DH panel. I tried to restart just the nginx using the command but I don’t have permission to do it on VPS (I tried to create an admin user for this VPS, no success).