Last active
November 13, 2021 11:01
-
-
Save mbpcoder/333d6b8d7b31c3a5029521fff67c7abd to your computer and use it in GitHub Desktop.
Nginx Configuration 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
server { | |
# Hide Nginx version | |
server_tokens off; | |
client_max_body_size 16M; | |
## | |
# `gzip` Settings | |
# | |
# | |
gzip on; | |
gzip_disable "msie6"; | |
gzip_vary on; | |
gzip_proxied any; | |
gzip_comp_level 6; | |
gzip_buffers 16 8k; | |
gzip_http_version 1.1; | |
gzip_min_length 256; | |
gzip_types | |
application/atom+xml | |
application/geo+json | |
application/javascript | |
application/x-javascript | |
application/json | |
application/ld+json | |
application/manifest+json | |
application/rdf+xml | |
application/xhtml+xml | |
application/xml | |
font/eot | |
font/otf | |
font/ttf | |
font/woff | |
font/woff2 | |
image/svg+xml | |
text/css | |
text/javascript | |
text/plain | |
text/xml; | |
listen 80; | |
listen [::]:80; | |
root /var/www/example.com/public; | |
index index.php index.html index.htm index.nginx-debian.html; | |
server_name example.com www.example.com; | |
# browser caching of static assets | |
location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf)$ { | |
expires 365d; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ \.php$ { | |
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment