Skip to content

Instantly share code, notes, and snippets.

@kalair92
Created August 10, 2023 10:42
Show Gist options
  • Save kalair92/b75bb9144e128365f84e0a9d479c2b6e to your computer and use it in GitHub Desktop.
Save kalair92/b75bb9144e128365f84e0a9d479c2b6e to your computer and use it in GitHub Desktop.
Nginx configuration for Laravel
# *projectname* Change the name as per your desired project directory
server {
listen 80;
server_name localhost;
root /var/www/*projectname*/public; #root_path
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?_url=$uri&$args;
}
location ~ \.php {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index /index.php;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment