Skip to content

Instantly share code, notes, and snippets.

@kamerk22
Last active August 21, 2018 17:49
Show Gist options
  • Save kamerk22/09486cc8433f238b6981816f699e4310 to your computer and use it in GitHub Desktop.
Save kamerk22/09486cc8433f238b6981816f699e4310 to your computer and use it in GitHub Desktop.
Laravel or Lumen application inside sub directory nginx configuration with routing.
server {
listen 80;
server_name dev ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /api {
try_files /api/$uri /api/$uri/ /api/index.php?q=$uri&$args;
}
location /phpmyadmin {
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment