Last active
May 7, 2022 16:44
-
-
Save pixeline/cd79b354732482dc52be368bc95d5ca7 to your computer and use it in GitHub Desktop.
virtualhost Template (Nginx)
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 { | |
root template.webroot; | |
server_name template.url; | |
index index.php index.html index.htm; | |
# HTTP Caching of static assets | |
location ~* \.(css|gif|jpg|js|png|ico|otf|sng|xls|doc|exe|jpeg|tgx)$ { | |
access_log off; | |
expires max; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
# try_files $uri $uri/ =404; | |
} | |
# pass PHP scripts to FastCGI server | |
location ~ \.php$ { | |
try_files $uri /index.php =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_intercept_errors off; | |
fastcgi_buffer_size 16k; | |
fastcgi_buffers 4 16k; | |
fastcgi_connect_timeout 600; | |
fastcgi_send_timeout 600; | |
fastcgi_read_timeout 600; | |
} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment