Ispconfig limits user webspace to public /web
folder and /private
folder. Since Laravel needs to use parent of public folder directory it is necessary to put all project files to /web
including public
folder. Here are working directives for nginx that allows to run laravel api project using ispconfig3 nginx directives that can be saved in admin panel and used for domain configuration. It redirects all public queries to /web/public
folder.
location / {
if (!uri) { rewrite ^ /public/index.php; }
try_files /public/$uri /public/$uri/ @rewrite;
}
location @rewrite {
rewrite ^/(.*)$ /public_html/index.php?$query_string;
}
location = /public_html/favicon.ico { access_log off; log_not_found off; }
location = /public_html/robots.txt { access_log off; log_not_found off; }
location ~ /\.(?!well-known).* {
deny all;
}
error_page 404 /public_html/index.php;