mirror of
https://github.com/samuelhbne/server-xray.git
synced 2025-12-18 12:54:39 +03:00
remote_addr pass through
This commit is contained in:
@@ -6,4 +6,7 @@
|
|||||||
client_body_timeout 1071906480m;
|
client_body_timeout 1071906480m;
|
||||||
grpc_read_timeout 1071906480m;
|
grpc_read_timeout 1071906480m;
|
||||||
grpc_pass grpc://HOST:PORT;
|
grpc_pass grpc://HOST:PORT;
|
||||||
|
grpc_set_header Host $host;
|
||||||
|
grpc_set_header X-Real-IP $remote_addr;
|
||||||
|
grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
location LOCATION {
|
location LOCATION {
|
||||||
proxy_pass http://HOST:PORT;
|
proxy_pass http://HOST:PORT;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
}
|
}
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
proxy_pass http://HOST:PORT;
|
proxy_pass http://HOST:PORT;
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ NGCONF="/etc/nginx/nginx.conf"
|
|||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "server-nginx --ng-server <c=certhome,d=domain>[,p=443] --ng-proxy <p=xport,l=location,n=grpc|ws|splt>[,h=127.0.0.1]"
|
echo "server-nginx --ng-server <c=certhome,d=domain>[,p=443] --ng-proxy <p=xport,l=location,n=grpc|ws|splt>[,h=127.0.0.1]"
|
||||||
echo " --ng-server <c=cert-home-dir,d=host-domain>[,p=443]"
|
|
||||||
echo " --ng-proxy <p=port-backend,l=location-path,n=grpc|ws|splt>[,h=127.0.0.1][,d=host-domain]"
|
echo " --ng-proxy <p=port-backend,l=location-path,n=grpc|ws|splt>[,h=127.0.0.1][,d=host-domain]"
|
||||||
echo " --st-port <port-num>"
|
echo " --ng-server <c=cert-home-dir,d=host-domain>[,p=443]"
|
||||||
echo " --st-map <sni=domain.com,ups=127.0.0.1:8443>"
|
echo " --st-map <sni=domain.com,ups=127.0.0.1:8443>"
|
||||||
|
echo " --st-port <port-num>"
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMP=`getopt -o m:p:s:x: --long ng-server:,ng-proxy:,st-map:,st-port: -n "$0" -- $@`
|
TEMP=`getopt -o m:p:s:x: --long ng-server:,ng-proxy:,st-map:,st-port: -n "$0" -- $@`
|
||||||
@@ -48,7 +48,11 @@ while true ; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "${NGSVR}" ] && [ -z "${STPORT}" ]; then echo "No server/stream defined. Quit."; exit 1; fi
|
if [ -z "${NGSVR}" ] && [ -z "${STPORT}" ]; then
|
||||||
|
echo "No server/stream defined. Quit.";
|
||||||
|
usage;
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
# Running as root to enable low port listening. Necessary for Fargate or k8s.
|
# Running as root to enable low port listening. Necessary for Fargate or k8s.
|
||||||
# sed -i 's/^user nginx;$/user root;/g' /etc/nginx/nginx.conf
|
# sed -i 's/^user nginx;$/user root;/g' /etc/nginx/nginx.conf
|
||||||
@@ -59,11 +63,12 @@ if [ -f /etc/nginx/conf.d/default.conf ]; then
|
|||||||
mv default.conf default.conf.disable
|
mv default.conf default.conf.disable
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${STPORT}" ]; then
|
|
||||||
# Remove all lines generated previously after #STSTUB tag.
|
# Remove all lines generated previously after #STSTUB tag.
|
||||||
sed -i '/\#STSTUB/q' /etc/nginx/nginx.conf
|
sed -i '/\#STSTUB/q' /etc/nginx/nginx.conf
|
||||||
# Remove #STSTUB tag
|
# Remove #STSTUB tag
|
||||||
sed -i '/\#STSTUB/d' /etc/nginx/nginx.conf
|
sed -i '/\#STSTUB/d' /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
if [ -n "${STPORT}" ]; then
|
||||||
rm /tmp/map.conf
|
rm /tmp/map.conf
|
||||||
rm /tmp/ups.conf
|
rm /tmp/ups.conf
|
||||||
# Attach the stream configuration to the tail of nginx.conf
|
# Attach the stream configuration to the tail of nginx.conf
|
||||||
|
|||||||
Reference in New Issue
Block a user