Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alectrocute/bf141966f82356519b98ed0296a8877f to your computer and use it in GitHub Desktop.
Save alectrocute/bf141966f82356519b98ed0296a8877f to your computer and use it in GitHub Desktop.
Example index.php file:
<?php
//if ($_SERVER['REMOTE_HOST'] != "_") {
//echo $_SERVER['SERVER_NAME'] . " blocked.";
// } else {
//echo "hi.";
//}
echo $_SERVER['HTTP_HOST'];
?>
Example nginx config:
(empty.gif is a tiny 1x1px image)
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.php;
autoindex off;
server_name _;
error_page 404 /empty.gif;
error_page 415 /empty.gif;
error_page 410 /empty.gif;
location / {
expires max;
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment