Answer the question
In order to leave comments, you need to log in
How to make Nginx run faster on Windows?
I work with OpenServer using Nginx 1.7
I observe the following situation:
My local PC:
8 cores 3.2, 8GB RAM, wine 2012 server
Default Nginx config (+- hosts setting)
Hoster:
Physical server, 2 cores 2.2, 1GB RAM, Debian
Default Nginx config (+- hosts setup)
Why does hoster's Nginx work 5 times faster than my local one? I understand that Linux is cool, that there is a fast file system, but still somehow it's a shame. Is it possible to overclock this thing on Windows?
What configurations should be in order for nginx to work faster, maybe I missed something?
And taking this opportunity, please tell me how to get rid of 504 Gateway Time-out on nginx. All the advice that I found on various sites did not solve my problems.
OpenServer nginx config
#---------------------------------------------#
# Основная конфигурация сервера Nginx
#---------------------------------------------#
worker_processes 1;
pid "%sprogdir%/userdata/temp/nginx.pid";
error_log "%sprogdir%/userdata/logs/%httpdriver%_error.log" warn;
events {
worker_connections 1024;
}
http {
include "%sprogdir%/modules/http/%httpdriver%/conf/mimen.types";
error_log "%sprogdir%/userdata/logs/%httpdriver%_error.log" debug;
default_type application/octet-stream;
%httpcharset%
log_format main '$host: $remote_addr [$time_local] '
'"$request" "$http_referer" $status $bytes_sent '
'"$http_user_agent" "$http_x_forwarded_for"';
%logstring%
autoindex on;
tcp_nopush on;
tcp_nodelay on;
reset_timedout_connection on;
ignore_invalid_headers off;
server_tokens off;
keepalive_timeout 10000;
#---------------------------------------------#
# Конфигурация буферов
#---------------------------------------------#
proxy_connect_timeout 6000;
proxy_send_timeout 6000;
proxy_read_timeout 6000;
client_body_timeout 10m;
client_body_buffer_size 512k;
client_header_buffer_size 16k;
client_header_timeout 10m;
client_max_body_size 50m;
large_client_header_buffers 4 8k;
send_timeout 10m;
server_names_hash_bucket_size 512;
server_names_hash_max_size 4096;
server_name_in_redirect off;
#---------------------------------------------#
# Конфигурация GZIP
#---------------------------------------------#
gzip on;
gzip_buffers 4 64k;
gzip_comp_level 6;
gzip_disable "msie6";
gzip_min_length 32768;
gzip_proxied any;
gzip_static off;
gzip_vary on;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
#---------------------------------------------#
# Указание временных каталогов
#---------------------------------------------#
client_body_temp_path "%sprogdir%/userdata/temp" 1 2;
fastcgi_temp_path "%sprogdir%/userdata/temp" 1 2;
proxy_temp_path "%sprogdir%/userdata/temp" 1 2;
scgi_temp_path "%sprogdir%/userdata/temp" 1 2;
uwsgi_temp_path "%sprogdir%/userdata/temp" 1 2;
#---------------------------------------------#
# Конфигурация SSL
#---------------------------------------------#
ssl_certificate "%sprogdir%/userdata/config/server.crt";
ssl_certificate_key "%sprogdir%/userdata/config/server.key";
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_session_cache builtin:5000;
ssl_prefer_server_ciphers on;
#---------------------------------------------#
# FastCGI PHP
#---------------------------------------------#
%streams%
#---------------------------------------------#
# Первичный виртуальный хост "по умолчанию"
#---------------------------------------------#
server {
listen %ip%:%httpport% default_server;
listen %ip%:%httpsport% default_server ssl;
location / {
root %sprogdir%/modules/system/html/default;
index index.html;
}
# Не удаляйте следующую строку конфигурации!
include "%sprogdir%/userdata/temp/config/%httpdriver%_url.conf";
}
#---------------------------------------------#
# Конец конфигурации хоста "по умолчанию"
#---------------------------------------------#
include "%sprogdir%/nginx.conf/*.conf";
#---------------------------------------------#
# Начало шаблона конфигурации хоста
#---------------------------------------------#
server {
listen %ip%:%httpport%;
listen %ip%:%httpsport% ssl;
server_name %host% %aliases%;
#if ($request_method !~* ^(GET|HEAD|POST|DELETE)$ ){return 403;}
location ~ /\. {deny all;}
%limit%
location / {
root "%hostdir%";
index index.php index.html index.htm;
}
location ~ \.php$ {
root "%hostdir%";
try_files $uri =404;
# if (!-e $document_root$document_uri){return 404;}
fastcgi_pass backend;
fastcgi_index index.php;
fastcgi_param TMP "%sprogdir%/userdata/temp";
fastcgi_param TMPDIR "%sprogdir%/userdata/temp";
fastcgi_param TEMP "%sprogdir%/userdata/temp";
fastcgi_buffers 4 64k;
fastcgi_connect_timeout 1s;
fastcgi_ignore_client_abort off;
fastcgi_next_upstream timeout;
fastcgi_read_timeout 3000s;
fastcgi_send_timeout 3000s;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param HTTPS $https;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $host;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
# Не удаляйте следующую строку конфигурации!
include "%sprogdir%/userdata/temp/config/%httpdriver%_url.conf";
}
#---------------------------------------------#
# Конец шаблона конфигурации хоста
#---------------------------------------------#
Answer the question
In order to leave comments, you need to log in
Currently, only select() is used as the connection handling method, so don't expect high performance and scalability. Because of this and a number of other known issues, the Windows version of nginx is currently considered a beta version.
nginx.org/ru/docs/windows.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question