d2ray/image/nginx/nginx.conf

47 lines
776 B
Nginx Configuration File

user www www;
worker_processes auto;
error_log /opt/config/logs/nginx/error.log;
pid /tmp/nginx.pid;
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;
server {
listen 80 default_server;
server_name _;
access_log /opt/config/logs/nginx/access.log;
if ($external) {
return 301 https://$host$request_uri:8443;
}
location / {
root /opt/nginx/webroot;
index index.html;
}
location /download {
root /opt/nginx/;
autoindex on;
auth_basic "Provide credentials to access downloads";
auth_basic_user_file "/opt/nginx/.htpasswd";
}
}
}