Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HAPROXY.CFG
- global
- log /dev/log local0
- log /dev/log local1 info
- #chroot /var/lib/haproxy
- stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
- stats timeout 30s
- #user haproxy
- #group haproxy
- daemon
- # Default SSL material locations
- ca-base /etc/ssl/certs
- crt-base /etc/ssl/private
- # intermediate configuration
- ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
- ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
- ssl-default-bind-options prefer-client-ciphers no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets
- ssl-default-server-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
- ssl-default-server-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
- ssl-default-server-options no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets
- ssl-dh-param-file /etc/ssl/certs/dhparam.pem
- defaults
- log global
- mode http
- option tcplog
- option dontlognull
- timeout connect 5000
- timeout client 50000
- timeout server 50000
- errorfile 400 /etc/haproxy/errors/400.http
- errorfile 403 /etc/haproxy/errors/403.http
- errorfile 408 /etc/haproxy/errors/408.http
- errorfile 500 /etc/haproxy/errors/500.http
- errorfile 502 /etc/haproxy/errors/502.http
- errorfile 503 /etc/haproxy/errors/503.http
- errorfile 504 /etc/haproxy/errors/504.http
- # Naive auth
- userlist users
- user username insecure-password password
- frontend ssl_passthrough
- mode tcp
- bind *:443
- tcp-request inspect-delay 5s
- tcp-request content accept if { req_ssl_hello_type 1 }
- use_backend tcp_loopback if { req_ssl_sni -i your.domain.com }
- default_backend nginx_tcp
- backend tcp_loopback
- mode tcp
- server loopback-for-tcp abns@haproxy-tcp send-proxy-v2
- # Nginx
- backend nginx_tcp
- mode tcp
- server nginx 127.0.0.1:8082 send-proxy-v2
- frontend tls
- mode tcp
- bind abns@haproxy-tcp accept-proxy ssl crt /etc/haproxy/certs/fullchain.pem alpn h2,http/1.1
- tcp-request inspect-delay 5s
- tcp-request content accept if HTTP
- # V2ray checks
- acl v2ray_host hdr(host) -i your.domain.com
- acl hdr_connection_upgrade hdr(Connection) -i upgrade
- acl hdr_upgrade_websocket hdr(Upgrade) -i websocket
- acl websocket_path path -i /ray
- use_backend v2ray_vless-ws if v2ray_host websocket_path hdr_connection_upgrade hdr_upgrade_websocket
- # HTTP Web
- use_backend redir_https if HTTP
- # V2ray
- default_backend v2ray_trojan-tcp
- # V2ray backend
- backend v2ray_vless-tcp
- mode tcp
- server v2ray 127.0.0.1:56667 send-proxy
- backend v2ray_vless-ws
- mode tcp
- server v2ray 127.0.0.1:56666 send-proxy
- backend v2ray_trojan-tcp
- mode tcp
- server v2ray 127.0.0.1:56665 send-proxy
- # TCP-HTTP bridge
- backend redir_https
- mode tcp
- server loopback-for-https abns@haproxy-https send-proxy-v2
- # Naive checks
- frontend fe-https
- mode http
- option httplog
- bind abns@haproxy-https accept-proxy
- option http-use-proxy-header
- acl login base_dom login-somekey.domain.com
- acl auth_ok http_auth(users)
- http-request auth if login !auth_ok
- http-request redirect location https://your.domain.com if login auth_ok
- use_backend proxy if auth_ok
- default_backend nginx-h2
- # Naive backend
- backend proxy
- http-request del-header proxy-authorization
- server naive 127.0.0.1:8888
- # Nginx
- backend nginx-h2
- server nginx 127.0.0.1:8082 send-proxy-v2 ssl verify none alpn h2
- XRAY.JSON
- {
- "log": {
- "loglevel": "warning",
- "access": "/var/log/xray/ws-access.log",
- "error": "/var/log/xray/ws-error.log"
- },
- "routing": {
- "domainStrategy": "AsIs",
- "rules": [
- {
- "type": "field",
- "ip": [
- "geoip:private"
- ],
- "outboundTag": "block"
- }
- ]
- },
- "inbounds": [
- {
- "port": 56667,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [{
- "id": "uuid"
- }],
- "decryption": "none",
- "fallbacks": [{
- "alpn": "",
- "dest": 8081,
- "xver": 1
- },
- {
- "alpn": "h2",
- "dest": 8082,
- "xver": 1
- }
- ]
- },
- "streamSettings": {
- "tlsSettings": {
- "alpn": [
- "h2",
- "http/1.1"
- ]
- },
- "tcpSettings": {
- "acceptProxyProtocol": true
- }
- }
- },
- {
- "port": 56666,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": "uuid",
- "level": 1,
- "alterId": 100
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/ray",
- "host": ["your.domain.com"]
- }
- }
- },
- {
- "port": "56665",
- "listen": "127.0.0.1",
- "protocol": "trojan",
- "settings": {
- "clients": [{
- "password": "changeme"
- }],
- "fallbacks": [{
- "alpn": "",
- "dest": 56667,
- "xver": 1
- }]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true
- }
- }
- }
- ],
- "outbounds": [
- {
- "protocol": "freedom",
- "tag": "direct"
- },
- {
- "protocol": "blackhole",
- "tag": "blocked"
- }
- ]
- }
- NGINX.CONF
- listen 127.0.0.1:8081 ssl proxy_protocol;
- listen 127.0.0.1:8082 ssl http2 proxy_protocol;
- set_real_ip_from 127.0.0.1;
- real_ip_header X-Forwarded-For;
- real_ip_recursive on;
- real_ip_header proxy_protocol;
- XRAY-CLIENT-WS.JSON
- {
- "log": {
- "loglevel": "debug"
- },
- "routing": {
- "domainStrategy": "AsIs",
- "rules": [
- {
- "type": "field",
- "ip": ["geoip:private"],
- "outboundTag": "direct"
- }
- ]
- },
- "dns": {"servers": ["8.8.8.8"]},
- "inbounds": [{
- "port": 10800,
- "listen": "127.0.0.1",
- "tag": "socks-ws-inbound",
- "protocol": "socks",
- "settings": {
- "auth": "noauth",
- "udp": true,
- "ip": "127.0.0.1"
- },
- "sniffing": {
- "enabled": false,
- "destOverride": ["http", "tls"]
- }
- }],
- "outbounds": [{
- "protocol": "vless",
- "settings": {
- "vnext": [{
- "address": "your.domain.com",
- "port": 443,
- "users": [
- { "id": "uuid",
- "encryption": "none",
- "alterId": 100 }
- ]
- }]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "tlsSettings": {
- "serverName": "your.domain.com"
- },
- "wsSettings": {
- "path": "/ray",
- "headers": {
- "Host": "your.domain.com"
- }
- }
- }
- },{
- "protocol": "freedom",
- "settings": {},
- "tag": "direct"
- },{
- "protocol": "blackhole",
- "settings": {},
- "tag": "blocked"
- }],
- "policy": {
- "levels": {
- "0": {
- "uplinkOnly": 0,
- "downlinkOnly": 0
- }
- },
- "system": {
- "statsInboundUplink": false,
- "statsInboundDownlink": false,
- "statsOutboundUplink": false,
- "statsOutboundDownlink": false
- }
- },
- "other": {}
- }
- XRAY-CLIENT-TCP.JSON
- {
- "log": {
- "loglevel": "debug"
- },
- "routing": {
- "domainStrategy": "AsIs",
- "rules": [
- {
- "type": "field",
- "ip": ["geoip:private"],
- "outboundTag": "direct"
- }
- ]
- },
- "dns": {"servers": ["8.8.8.8"]},
- "inbounds": [{
- "port": 10800,
- "listen": "127.0.0.1",
- "tag": "socks-ws-inbound",
- "protocol": "socks",
- "settings": {
- "auth": "noauth",
- "udp": true,
- "ip": "127.0.0.1"
- },
- "sniffing": {
- "enabled": false,
- "destOverride": ["http", "tls"]
- }
- }],
- "outbounds": [{
- "protocol": "vless",
- "settings": {
- "vnext": [{
- "address": "your.domain.com",
- "port": 443,
- "users": [
- { "id": "uuid",
- "encryption": "none",
- "alterId": 100 }
- ]
- }]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "serverName": "your.domain.com"
- }
- }
- },{
- "protocol": "freedom",
- "settings": {},
- "tag": "direct"
- },{
- "protocol": "blackhole",
- "settings": {},
- "tag": "blocked"
- }],
- "policy": {
- "levels": {
- "0": {
- "uplinkOnly": 0,
- "downlinkOnly": 0
- }
- },
- "system": {
- "statsInboundUplink": false,
- "statsInboundDownlink": false,
- "statsOutboundUplink": false,
- "statsOutboundDownlink": false
- }
- },
- "other": {}
- }
- XRAY-CLIENT-TROJAN.JSON
- {
- "log": {
- "loglevel": "debug"
- },
- "dns": {"servers": ["8.8.8.8"]},
- "inbounds": [{
- "port": 10800,
- "listen": "127.0.0.1",
- "tag": "socks-ws-inbound",
- "protocol": "socks",
- "settings": {
- "auth": "noauth",
- "udp": true,
- "ip": "127.0.0.1"
- },
- "sniffing": {
- "enabled": false,
- "destOverride": ["http", "tls"]
- }
- }],
- "outbounds": [{
- "protocol": "trojan",
- "settings": {
- "servers": [{
- "address": "your.domain.com",
- "port": 443,
- "password": "changeme"
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls"
- }
- }]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement