Created
December 31, 2024 14:36
-
-
Save asterion/f7b0fee94a889fa699a2e8820a9f11cb to your computer and use it in GitHub Desktop.
Nginx Laravel PHP FPM
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
# Nginx global configuration | |
user nginx; | |
worker_processes auto; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
# Logging settings | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
# Gzip configuration (optional, can improve performance) | |
gzip on; | |
gzip_types text/plain application/xml text/css text/javascript application/javascript application/json; | |
server { | |
listen 80; | |
server_name localhost; | |
root /var/www/html/public; | |
index index.php index.html index.htm; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ \.php$ { | |
include fastcgi_params; | |
fastcgi_pass php-fpm:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
location ~ /\.(?!well-known).* { | |
deny all; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment