Skip to content

Instantly share code, notes, and snippets.

@jaeyson
Created October 7, 2025 04:39
Show Gist options
  • Save jaeyson/bbdeb7d28231af7bb991321d00c8a78c to your computer and use it in GitHub Desktop.
Save jaeyson/bbdeb7d28231af7bb991321d00c8a78c to your computer and use it in GitHub Desktop.
Lumen/Laravel Nginx configuration example

In this Nginx configuration Lumen is actually installed within /home/mydomainfolder/html/admin/api/, so this is the root folder of Lumen installation. The public folder within this api directory is created by Lumen.

Replace <your_domain> with your actual domainname in Nginx (or use localhost for development).

Change /var/www/mydomainfolder/html to your actual website location on disk.

Change /var/run/php-fpm/php-fpm.sock to the correct PHP fpm socket file (eg. it could also be /var/run/php/php7.3-fpm.sock for example)

server {
listen 80;
server_name <your_domain>;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name <your_domain>;
ssl_certificate /location/of/server.crt;
ssl_certificate_key /location/of/server.key;
root /var/www/mydomainfolder/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
location /admin/api {
root /home/mydomainfolder/html/admin/api/public;
try_files $uri $uri/ /admin/api/public/index.php?$query_string;
}
# pass to php-fpm
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_intercept_errors on;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment