mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-22 08:31:30 +00:00
Fix test naive inbound with nginx
This commit is contained in:
parent
9edfe7d9d3
commit
e750c747c6
|
@ -1,22 +1,18 @@
|
||||||
server {
|
stream {
|
||||||
listen 10000 ssl http2;
|
server {
|
||||||
listen [::]:10000 ssl http2;
|
listen 10000 ssl;
|
||||||
|
listen [::]:10000 ssl;
|
||||||
|
|
||||||
server_name example.org;
|
ssl_certificate /etc/nginx/cert.pem;
|
||||||
ssl_certificate /etc/nginx/cert.pem;
|
ssl_certificate_key /etc/nginx/key.pem;
|
||||||
ssl_certificate_key /etc/nginx/key.pem;
|
ssl_session_timeout 1d;
|
||||||
ssl_session_timeout 1d;
|
ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
|
||||||
ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
|
ssl_session_tickets off;
|
||||||
ssl_session_tickets off;
|
|
||||||
|
|
||||||
# modern configuration
|
# modern configuration
|
||||||
ssl_protocols TLSv1.3;
|
ssl_protocols TLSv1.3;
|
||||||
ssl_prefer_server_ciphers off;
|
ssl_prefer_server_ciphers off;
|
||||||
|
|
||||||
# HSTS (ngx_http_headers_module is required) (63072000 seconds)
|
proxy_pass 127.0.0.1:10003;
|
||||||
add_header Strict-Transport-Security "max-age=63072000" always;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://127.0.0.1:10003;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
29
test/config/nginx.conf
Normal file
29
test/config/nginx.conf
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
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/naive.conf;
|
|
@ -10,12 +10,11 @@ import (
|
||||||
"github.com/sagernet/sing/common/network"
|
"github.com/sagernet/sing/common/network"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FIXME: nginx do not support CONNECT
|
func TestNaiveInboundWithNginx(t *testing.T) {
|
||||||
func _TestNaiveInboundWithNingx(t *testing.T) {
|
|
||||||
caPem, certPem, keyPem := createSelfSignedCertificate(t, "example.org")
|
caPem, certPem, keyPem := createSelfSignedCertificate(t, "example.org")
|
||||||
startInstance(t, option.Options{
|
startInstance(t, option.Options{
|
||||||
Log: &option.LogOptions{
|
Log: &option.LogOptions{
|
||||||
Level: "trace",
|
Level: "error",
|
||||||
},
|
},
|
||||||
Inbounds: []option.Inbound{
|
Inbounds: []option.Inbound{
|
||||||
{
|
{
|
||||||
|
@ -40,6 +39,7 @@ func _TestNaiveInboundWithNingx(t *testing.T) {
|
||||||
Image: ImageNginx,
|
Image: ImageNginx,
|
||||||
Ports: []uint16{serverPort, otherPort},
|
Ports: []uint16{serverPort, otherPort},
|
||||||
Bind: map[string]string{
|
Bind: map[string]string{
|
||||||
|
"nginx.conf": "/etc/nginx/nginx.conf",
|
||||||
"naive-nginx.conf": "/etc/nginx/conf.d/naive.conf",
|
"naive-nginx.conf": "/etc/nginx/conf.d/naive.conf",
|
||||||
certPem: "/etc/nginx/cert.pem",
|
certPem: "/etc/nginx/cert.pem",
|
||||||
keyPem: "/etc/nginx/key.pem",
|
keyPem: "/etc/nginx/key.pem",
|
||||||
|
|
Loading…
Reference in a new issue