Created
April 1, 2019 02:24
-
-
Save blockloop/eacb2ae0c89947863d56e2c60b3b1e2a to your computer and use it in GitHub Desktop.
NGINX static hosting
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
user nginx; | |
worker_processes 1; | |
error_log /dev/stderr warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
access_log /dev/stdout main; | |
sendfile on; | |
keepalive_timeout 65; | |
gzip on; | |
server { | |
listen 80; | |
server_tokens off; | |
add_header X-Frame-Options 'SAMEORIGIN'; | |
add_header X-XSS-Protection '1; mode=block'; | |
error_page 404 /404.html; | |
location = /404.html { | |
root /var/www/; | |
internal; | |
} | |
if ($request_method !~ ^(GET|HEAD)$ ) | |
{ | |
return 405; | |
} | |
index index.html; | |
root /var/www/; | |
location /ping { | |
access_log off; | |
return 200 'pong'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment