Created
June 10, 2024 14:13
-
-
Save gbhorwood/0714ba45d956d1c5d0d46ed0dbfed4eb to your computer and use it in GitHub Desktop.
nginx geoip virtual host
This file contains 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 <domain name>; | |
root "<path to repository>"; | |
index index.html index.htm index.php; | |
charset utf-8; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php<php version>-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
### | |
# geoip2 variables | |
fastcgi_param COUNTRY_CODE $geoip2_data_country_code; | |
fastcgi_param COUNTRY_NAME $geoip2_data_country_name; | |
fastcgi_param CITY_NAME $geoip2_data_city_name; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_intercept_errors off; | |
fastcgi_buffer_size 16k; | |
fastcgi_buffers 4 16k; | |
fastcgi_connect_timeout 300; | |
fastcgi_send_timeout 300; | |
fastcgi_read_timeout 300; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
location = /favicon.ico { access_log off; log_not_found off; } | |
location = /robots.txt { access_log off; log_not_found off; } | |
access_log /var/log/nginx/<access log name>.log combined; | |
error_log /var/log/nginx/<error log name>.log error; | |
sendfile off; | |
client_max_body_size 100m; | |
listen 80; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment