Skip to content

Commit 1a3d806

Browse files
committed
Nginx config updates
1 parent 042701f commit 1a3d806

5 files changed

+40
-16
lines changed

.gitlab-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Build:
1313
- docker
1414
script:
1515
- sed -i "s/ghcr.io/${CI_REGISTRY}/g" Dockerfile
16-
- sed -i "s/:master/:latest/g" Dockerfile
16+
- sed -i "s/:master/:latest/g" Dockerfile
1717
- >
1818
docker build
1919
--pull

entrypoint.sh

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ CODER_SERVICE=${CODER_SERVICE:-coder}
1515
PGADMIN_PORT=${PGADMIN_PORT:-80}
1616
PGADMIN_SERVICE=${PGADMIN_SERVICE:-pgadmin}
1717

18+
MINIO_PORT=${MINIO_PORT:-9000}
19+
MINIO_SERVICE=${MINIO_SERVICE:-minio}
20+
1821
# Reset the proxy and localhost config
1922
echo "" > /etc/nginx/proxy.conf
2023
echo "" > /etc/nginx/localhost.conf

frontend_localhost_service.conf

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
server {
22
server_name localhost;
3-
listen 443 ssl http2;
4-
listen [::]:443 ssl http2;
3+
listen 443 ssl;
4+
listen [::]:443 ssl;
5+
6+
http2 on;
57

68
add_header X-Content-Type-Options nosniff;
79
ssl_protocols TLSv1.2 TLSv1.3;
@@ -23,4 +25,4 @@ server {
2325
proxy_set_header Upgrade $http_upgrade;
2426
proxy_set_header Connection $connection_upgrade;
2527
}
26-
}
28+
}

inject-config

+21-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ echo ' proxy_set_header X-Forwarded-Proto https;';
1212
echo ' proxy_set_header X-Forwarded-Host localhost;';
1313
echo ' proxy_set_header X-Real-IP $remote_addr;';
1414
echo ' proxy_redirect off;';
15-
echo ' proxy_http_version 1.1;';
1615
echo '}';
1716

1817
echo 'location /ws {';
@@ -24,7 +23,6 @@ echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;';
2423
echo ' proxy_set_header X-Forwarded-Proto https;';
2524
echo ' proxy_set_header X-Forwarded-Host localhost;';
2625
echo ' proxy_set_header X-Real-IP $remote_addr;';
27-
echo ' proxy_http_version 1.1;';
2826
echo ' proxy_set_header Upgrade $http_upgrade;';
2927
echo ' proxy_set_header Connection $connection_upgrade;';
3028
echo '}';
@@ -46,7 +44,27 @@ echo ' proxy_connect_timeout 1800;';
4644
echo ' chunked_transfer_encoding on;';
4745
echo ' proxy_set_header Upgrade $http_upgrade;';
4846
echo ' proxy_set_header Connection "upgrade";';
49-
echo ' proxy_http_version 1.1;';
47+
echo ' proxy_redirect off;';
48+
echo ' proxy_buffering off;';
49+
echo '}'
50+
51+
fi
52+
53+
if [ $SERVICE = "minio" ]; then
54+
55+
echo 'location /minio/ {';
56+
echo ' rewrite /minio/(.*) /$1 break;';
57+
cat <<END
58+
proxy_pass http://$SERVICE:$PORT;
59+
END
60+
echo ' proxy_set_header Host $host;';
61+
echo ' proxy_set_header X-Real-IP $remote_addr;';
62+
echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;';
63+
echo ' proxy_read_timeout 1800;';
64+
echo ' proxy_connect_timeout 1800;';
65+
echo ' chunked_transfer_encoding on;';
66+
echo ' proxy_set_header Upgrade $http_upgrade;';
67+
echo ' proxy_set_header Connection "upgrade";';
5068
echo ' proxy_redirect off;';
5169
echo ' proxy_buffering off;';
5270
echo '}'
@@ -68,7 +86,6 @@ echo " proxy_set_header Host localhost;";
6886
echo ' proxy_set_header X-Real-IP $remote_addr;';
6987
echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;';
7088
echo ' proxy_set_header X-Forwarded-Host localhost;';
71-
echo ' proxy_http_version 1.1;';
7289
echo ' proxy_redirect off;';
7390
echo ' proxy_buffering off;';
7491
echo '}'
@@ -87,7 +104,6 @@ echo '
87104
proxy_set_header X-Real-IP $remote_addr;
88105
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
89106
proxy_set_header X-Forwarded-Proto $scheme;
90-
proxy_http_version 1.1;
91107
proxy_set_header Upgrade $http_upgrade;
92108
proxy_set_header Connection "upgrade";
93109
';
@@ -108,7 +124,6 @@ echo '
108124
proxy_set_header X-Real-IP $remote_addr;
109125
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
110126
proxy_set_header X-Forwarded-Proto $scheme;
111-
proxy_http_version 1.1;
112127
proxy_set_header Upgrade $http_upgrade;
113128
proxy_set_header Connection "upgrade";
114129
proxy_set_header X-Script-Name /pgadmin;

nginx.conf

+10-6
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,21 @@ http {
2121

2222
fastcgi_buffers 16 16k;
2323
fastcgi_buffer_size 32k;
24-
proxy_buffer_size 128k;
24+
25+
proxy_buffer_size 64k;
2526
proxy_buffers 4 256k;
2627
proxy_busy_buffers_size 256k;
2728

28-
client_body_buffer_size 10K;
29-
client_body_timeout 60;
29+
client_body_buffer_size 64K;
30+
client_body_timeout 10;
3031
client_header_buffer_size 64k;
3132
client_header_timeout 60;
3233
client_max_body_size 100m;
3334

3435
keepalive_timeout 60;
3536
large_client_header_buffers 4 64k;
3637
send_timeout 60;
38+
proxy_http_version 1.1;
3739

3840
include /etc/nginx/mime.types;
3941
default_type application/octet-stream;
@@ -78,8 +80,10 @@ http {
7880
}
7981

8082
server {
81-
listen 443 ssl http2;
82-
listen [::]:443 ssl http2;
83+
listen 443 ssl;
84+
listen [::]:443 ssl;
85+
86+
http2 on;
8387

8488
add_header X-Content-Type-Options nosniff;
8589
ssl_protocols TLSv1.2;
@@ -106,6 +110,7 @@ http {
106110
fastcgi_param SCRIPT_FILENAME /var/www/public/index.php;
107111
fastcgi_param SCRIPT_NAME /index.php;
108112
fastcgi_param REQUEST_URI /$uri?$args;
113+
fastcgi_buffering off;
109114
}
110115

111116
root /var/www/public;
@@ -124,7 +129,6 @@ http {
124129

125130
location /socketserver {
126131
proxy_pass http://websocket_ws;
127-
proxy_http_version 1.1;
128132
proxy_set_header Upgrade $http_upgrade;
129133
proxy_set_header Connection $connection_upgrade;
130134
proxy_set_header Host $host;

0 commit comments

Comments
 (0)