Nginx Laravel Config 7.4 FPM

Rendy wijaya
1 min readOct 17, 2021

Hello Brother and brader so today im embarassed myself, i have rent some vps and domain, so i want to deploy my website to that vps, my website environmnt is laravel php 7.4 mariadb and nginx, so i tried to clone project and config the nginx, and im wondering why my website not executed php instead of download it, altouh im realy sure there is nothing wrong with my config, so i tried every config in internet and nothing work, silly me of course it didnt work like i though cause i call the website by ipadress like 104.XXX.XXX not by domain, cause domain still in progress in domain provider, so by default if use ipadress you actually use default configuration on nginx, and either delete it or move it somewhere so it cannt execute

thats all

thanks nya~~

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

# Log files for Debugging
access_log /var/log/nginx/vhostlaravel-access.log;
error_log /var/log/nginx/vhostlaravel-error.log;

# Webroot Directory for Laravel project
root /var/www/html/;
index index.php index.html index.htm;

# Your Domain Name
server_name yourweb;

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

# PHP-FPM Configuration Nginx
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

https://cloudraya.com/knowledge-base/how-to-setup-your-own-laravel-with-nginx-in-ubuntu-18-04/

--

--