nginx apache freebsd
Для оптимизации системы и настройки nginx в качествете frontend к apache, я применил следующую конфигурацию.
В httpd.conf внес изменения
Listen 127.0.0.1:81
В extra/httpd-vhosts.conf (если есть виртуальные хосты)
Меняем по аналогии:
NameVirtualHost *:81
<VirtualHost *:81>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/usr/local/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "/var/log/dummy-host2.example.com-error_log"
CustomLog "/var/log/dummy-host2.example.com-access_log" common
</VirtualHost>
С apache разобрались, теперь идём в nginx.conf (предполагается что он уже установлен), предварительно забекапив файл, стираем из него все и пишем:
user www www;
worker_processes 2;
error_log /var/log/nginx-error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_refererxi"\xc2\xbb '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx-access.log main;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
client_header_buffer_size 1k;
large_client_header_buffers 4 4k;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain;
output_buffers 1 32k;
postpone_output 1460;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
server {
listen 80;
server_name exaple.com test.example.com;
location / {
proxy_pass http://127.0.0.1:81;
proxy_redirect off;
#proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 75;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 10m;
}
location ^.+\.(jpg|gif|avi|mp3|zip|js)$ {
root /usr/local/www/example.com/data;
index index.php;
}
}
}
Готово, можно проверять.
Добавить комментарий