Skip to content

Commit

Permalink
Added reuseport
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuNampoothiri committed Jan 28, 2024
1 parent 1e8bd0a commit fc86f9f
Showing 1 changed file with 106 additions and 108 deletions.
214 changes: 106 additions & 108 deletions files/OpenSpeedTest-Server.conf
Original file line number Diff line number Diff line change
@@ -1,108 +1,106 @@
# SpeedTest by OpenSpeedTest™ is a Free and Open-Source Network Speed Test Software.
# Like this Project? Please Donate NOW & Keep us Alive -> https://go.openspeedtest.com/Donate
# Thank you for your support! we greatly appreciate your donation.
# Your contribution helps us continue to improve and maintain the tool for everyone to use.
# Official Website : https://OpenSpeedTest.com | Email: [email protected]
# Developed by : Vishnu | https://Vishnu.Pro | Email : [email protected]

server {
server_name _ localhost YOURDOMAIN;
listen 3000;
listen 3001 ssl;
listen [::]:3000;
listen [::]:3001 ssl;
# If you like to Enable HTTP2 add "http2" to the above line.
# If HTTP2 Enabled. Upload location should Proxy_Pass to http 1.1 port.
# Otherwise you will see abnormal Upload Speeds.
# Nginx Server Windows SSL Performance was very poor! Better use Linux if you need SSL support.
ssl_certificate /etc/ssl/nginx.crt; # Use your own certificate & key
ssl_certificate_key /etc/ssl/nginx.key; # <-- key
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers "ALL";
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:100m;
ssl_session_timeout 1d;
ssl_session_tickets on;
root /usr/share/nginx/html/;
index index.html;
client_max_body_size 35m;
error_page 405 =200 $uri;
access_log off;
gzip off;
fastcgi_read_timeout 999;
log_not_found off;
server_tokens off;
error_log /dev/null; #Disable this for Windows Nginx.
tcp_nodelay on;
tcp_nopush on;
sendfile on;
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors off;

location ~ /\.well-known/acme-challenge/ {
allow all;
default_type "text/plain";
root /usr/share/nginx/html/;
try_files $uri =404;
break;
}

location / {

add_header 'Access-Control-Allow-Origin' "*" always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
#Very Very Important! You SHOULD send no-store from server for Google Chrome.
add_header Cache-Control 'no-store, no-cache, max-age=0, no-transform';
add_header Last-Modified $date_gmt;
if_modified_since off;
expires off;
etag off;

if ($request_method = OPTIONS ) {
add_header Access-Control-Allow-Credentials "true";
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With' always;
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
return 200;
}
}

#HTTP2 & HTTP3 will not wait for the post body and return 200. We need to stop that behaviour.
#Otherwise, you will see abnormal upload speed. To fix this issue, Enable the following lines. (Only Applicable If you Enabled HTTP2 or HTTP3 in This Server.)

#HTTP2 & HTTP3 -> UPLOAD FIX -- START

#location = /upload {
#proxy_pass http://127.0.0.1:3000/dev-null;
#}
#location = /dev-null {
#return 200;
#}

#HTTP2 & HTTP3 -> UPLOAD FIX -- END

#Caching for Static Files,
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|xml|otf|ttf|eot|woff|woff2|svg)$ {
access_log off;
expires 365d;
add_header Cache-Control public;
add_header Vary Accept-Encoding;
tcp_nodelay off;
open_file_cache max=3000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
}

}
# SpeedTest by OpenSpeedTest™ is a Free and Open-Source Network Speed Test Software.
# Like this Project? Please Donate NOW & Keep us Alive -> https://go.openspeedtest.com/Donate
# Thank you for your support! we greatly appreciate your donation.
# Your contribution helps us continue to improve and maintain the tool for everyone to use.
# Official Website : https://OpenSpeedTest.com | Email: [email protected]
# Developed by : Vishnu | https://Vishnu.Pro | Email : [email protected]

server {
server_name _ localhost YOURDOMAIN;
listen 3000 reuseport;
listen 3001 ssl reuseport;
listen [::]:3000 reuseport;
listen [::]:3001 ssl reuseport;
# If you like to Enable HTTP2 add "http2" to the above line.
# If HTTP2 Enabled. Upload location should Proxy_Pass to http 1.1 port.
# Otherwise you will see abnormal Upload Speeds.
# Nginx Server Windows SSL Performance was very poor! Better use Linux if you need SSL support.
ssl_certificate /etc/ssl/nginx.crt; # Use your own certificate & key
ssl_certificate_key /etc/ssl/nginx.key; # <-- key
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers "ALL";
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:100m;
ssl_session_timeout 1d;
ssl_session_tickets on;
root /usr/share/nginx/html/;
index index.html;
client_max_body_size 35m;
error_page 405 =200 $uri;
access_log off;
gzip off;
fastcgi_read_timeout 999;
log_not_found off;
server_tokens off;
error_log /dev/null; #Disable this for Windows Nginx.
tcp_nodelay on;
tcp_nopush on;
sendfile on;
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors off;

location ~ /\.well-known/acme-challenge/ {
allow all;
default_type "text/plain";
root /usr/share/nginx/html/;
try_files $uri =404;
break;
}

location / {
add_header 'Access-Control-Allow-Origin' "*" always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
#Very Very Important! You SHOULD send no-store from server for Google Chrome.
add_header Cache-Control 'no-store, no-cache, max-age=0, no-transform';
add_header Last-Modified $date_gmt;
if_modified_since off;
expires off;
etag off;

if ($request_method = OPTIONS ) {
add_header 'Access-Control-Allow-Credentials' "true";
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With' always;
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Methods' "GET, POST, OPTIONS" always;
return 200;
}
}

#HTTP2 & HTTP3 will not wait for the post body and return 200. We need to stop that behaviour.
#Otherwise, you will see abnormal upload speed. To fix this issue, Enable the following lines. (Only Applicable If you Enabled HTTP2 or HTTP3 in This Server.)

#HTTP2 & HTTP3 -> UPLOAD FIX -- START

#location = /upload {
# proxy_pass http://127.0.0.1:3000/dev-null;
#}
#location = /dev-null {
# return 200;
#}

#HTTP2 & HTTP3 -> UPLOAD FIX -- END

# Caching for Static Files,
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|xml|otf|ttf|eot|woff|woff2|svg)$ {
access_log off;
expires 365d;
add_header Cache-Control public;
add_header Vary Accept-Encoding;
tcp_nodelay off;
open_file_cache max=3000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
}
}

0 comments on commit fc86f9f

Please sign in to comment.