Created
December 10, 2021 09:19
-
-
Save memandip/72afe8243c8ebdaf90d76591a2105b86 to your computer and use it in GitHub Desktop.
Nginx configuration with laravel and static site. Routes with prefix `api` will be handled by laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name mydomain.com; | |
charset utf-8; | |
root /var/www/html/{Laravel_Project_DIR}/current/public; | |
index index.html index.php; | |
location /api { | |
try_files $uri $uri/ /index.php?$query_string; | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_param SCRIPT_FILENAME $request_filename; | |
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock; | |
} | |
} | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock; | |
} | |
location / { | |
root /var/www/html/{STATIC_SITE_DIR}; | |
try_files $uri $uri/ /index.html?$query_string; | |
} | |
location ~ /\.(?!well-known).* { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment