diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..50c39802 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM nginx:latest +MAINTAINER ifeng +EXPOSE 80 +USER root + +RUN apt-get update && apt-get install -y supervisor wget unzip + +#定义 UUID 及 伪装路径,请自行修改.(注意:伪装路径前无需加/符号,程序已自行添加.) +ENV UUID de04add9-5c68-8bab-950c-08cd5320df18 +ENV VMESS_WSPATH vmess +ENV VLESS_WSPATH vless + +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY nginx.conf /etc/nginx/nginx.conf + +RUN mkdir /etc/v2ray /usr/local/v2ray +COPY config.json /etc/v2ray/ +COPY entrypoint.sh /usr/local/v2ray/ +RUN chmod a+x /usr/local/v2ray/entrypoint.sh + +RUN wget -q -O /tmp/v2ray-linux-64.zip https://github.com/v2fly/v2ray-core/releases/download/v4.45.0/v2ray-linux-64.zip && \ + unzip -d /usr/local/v2ray /tmp/v2ray-linux-64.zip + +ENTRYPOINT [ "/usr/local/v2ray/entrypoint.sh" ] +CMD ["/usr/bin/supervisord"] \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 00000000..e866b915 --- /dev/null +++ b/config.json @@ -0,0 +1,53 @@ +{ + "log": { + "access": "/dev/null", + "error": "/dev/null", + "loglevel": "warning" + }, + "inbounds": [{ + "port": 10000, + "listen": "127.0.0.1", + "protocol": "vmess", + "settings": { + "clients": [{ + "id": "UUID", + "alterId": 0 + }] + }, + "streamSettings": { + "network": "ws", + "wsSettings": { + "path": "/VMESS_WSPATH" + } + } + }, + { + "port": 20000, + "listen": "127.0.0.1", + "protocol": "vless", + "settings": { + "clients": [{ + "id": "UUID" + }], + "decryption": "none" + }, + "streamSettings": { + "network": "ws", + "wsSettings": { + "path": "/VLESS_WSPATH" + } + } + } + ], + "outbounds": [{ + "protocol": "freedom", + "settings": {} + }], + "dns": { + "server": [ + "8.8.8.8", + "8.8.4.4", + "localhost" + ] + } +} diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000..ed75d8f2 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# Create By ifeng +# Web Site:https://www.hicairo.com +# Telegram:https://t.me/HiaiFeng + +sed -i "s/UUID/$UUID/g" /etc/v2ray/config.json +sed -i "s/VMESS_WSPATH/$VMESS_WSPATH/g" /etc/v2ray/config.json +sed -i "s/VLESS_WSPATH/$VLESS_WSPATH/g" /etc/v2ray/config.json +sed -i "s/VMESS_WSPATH/$VMESS_WSPATH/g" /etc/nginx/nginx.conf +sed -i "s/VLESS_WSPATH/$VLESS_WSPATH/g" /etc/nginx/nginx.conf +exec "$@" \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..bc6ede20 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,68 @@ + +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +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 /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + #include /etc/nginx/conf.d/*.conf; + + server { + listen 80 default_server; + listen [::]:80 default_server; + + server_name _; + charset utf-8; + root html; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + location /VMESS_WSPATH { + proxy_redirect off; + proxy_pass http://127.0.0.1:10000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection upgrade; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location /VLESS_WSPATH { + proxy_redirect off; + proxy_pass http://127.0.0.1:20000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection upgrade; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + } +} diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 00000000..1d5020fb --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,31 @@ +# Create By ifeng +# Web Site:https://www.hicairo.com +# Telegram:https://t.me/HiaiFeng + +[supervisord] +nodaemon=true +logfile=/var/log/supervisord.log +pidfile=/run/supervisord.pid + +[program:v2ray] +command=/usr/local/v2ray/v2ray -config=/etc/v2ray/config.json +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +redirect_stderr=true +autorestart=false +startretries=0 + +[program:nginx] +command=nginx -g 'daemon off;' +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +redirect_stderr=true +autorestart=false +startretries=0 + +# The below configure can be applied when Docker orchestrator like Docker Swarm or K8S is used. +# By default, supervisor will attempt to restart a failed process. +# Refer to http://supervisord.org/configuration.html for more info. +#[eventlistener:processes] +#command=stop-supervisor.sh +#events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL \ No newline at end of file