Laravel on nginx (VPS)

vps

#1

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/vide360.com.br

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 (www.vide360.com.br), but all the other pages (directed by /home/vi360/app/routes.php) are returning with error 404.

I have created the /home/vi360/nginx/vide360.com.br/vide360.conf as follow:

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

    root /home/vi360/vide360.com.br;
    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]


#2

I haven’t checked your code, but one quick suggestion: did you restart nginx after the changes to the conf file? See https://help.dreamhost.com/hc/en-us/articles/216454967-How-to-reload-and-restart-Nginx-Dedicated-servers-only-


#3

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).