d2ray/image/nginx/nginx.conf

47 lines
771 B
Nginx Configuration File
Raw Normal View History

2021-04-22 09:01:45 +00:00
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;
}
2021-04-23 08:23:14 +00:00
charset utf-8;
2021-04-22 09:01:45 +00:00
server {
listen 80 default_server;
server_name _;
access_log /opt/config/logs/nginx/access.log;
if ($external) {
return 301 https://$host$request_uri;
}
2021-04-23 06:51:06 +00:00
location / {
root /opt/nginx/webroot;
index index.html;
}
2021-04-23 07:25:34 +00:00
location /download {
root /opt/nginx/;
2021-04-23 06:51:06 +00:00
autoindex on;
auth_basic "Provide credentials to access downloads";
auth_basic_user_file "/opt/nginx/.htpasswd";
}
2021-04-22 09:01:45 +00:00
}
}