d2ray/opt/nginx/nginx.conf.in

51 lines
861 B
Nginx Configuration File

user www www;
worker_processes auto;
daemon off;
pid /tmp/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096; ## Default: 1024
}
http {
geo $external {
default 1;
127.0.0.1/32 0;
}
##
# WebSocket proxying
##
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
charset utf-8;
access_log /etc/d2ray/logs/nginx/access.log;
error_log /etc/d2ray/logs/nginx/error.log;
include /etc/nginx/mime.types;
server {
listen 80 default_server;
server_name _;
if ($external) {
return 301 https://$host:{{ PORT }}$request_uri;
}
location / {
root /opt/nginx/webroot;
index index.html;
}
location /download {
root /opt/nginx/;
autoindex on;
auth_basic "Please provide credentials to access this server";
auth_basic_user_file "/opt/nginx/.htpasswd";
}
}
}