This applies to apche+nginx as reverse proxy
I finally gave up so that at least my websites work and discovered smth that works (not that tis could not work)
seperate proxy server
I installed a small vps with nginx only and followed these instructions:
install nginx (
)
clear the config file (
Code:
echo > /etc/nginx/nginx.conf
)
edit the config file to have this in it:
Do it easy with
Code:
cat <<EOT >> /etc/nginx/nginx.conf
#user apache apache;
worker_processes 4; # Set it according to what your CPU have. 4 Cores = 4
worker_rlimit_nofile 8192;
pid /var/log/nginx.pid;
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_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for”‘;
server_tokens off;
access_log /var/log/nginx_access.log main;
error_log /var/log/nginx_error.log debug;
server_names_hash_bucket_size 64;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
keepalive_timeout 30;
gzip on;
gzip_comp_level 9;
gzip_proxied any;
proxy_buffering on;
proxy_cache_path /usr/local/nginx/proxy_temp levels=1:2 keys_zone=one:15m inactive=7d max_size=1000m;
proxy_buffer_size 16k;
proxy_buffers 100 8k;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
server {
# change the ip (xxx) in the next line to the ip of the server where u instal
listen xxx.xxx.xxx.xxx:80 default rcvbuf=8192 sndbuf=16384 backlog=32000;
server_name domain.name _ ; # “_” is for handle all hosts that are not described by server_name
charset off;
access_log /var/log/nginx_host_general.access.log main;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://xxx.xxx.xxx.xxx; # Set the ip (xxx) to the ip of the box serving your websites before proxy-ing
client_max_body_size 16m;
client_body_buffer_size 128k;
proxy_buffering on;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 120;
proxy_buffer_size 16k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
# below is include so that you can have separate setting per vhost. This will only work on single server setups
include /usr/local/directadmin/data/users/*/nginx.conf;
}
EOT
Changed over the DNS to reflect the ip address of the new vps and it rocks, no problem at all.
I now have a apache only server as backend with a proxy in front of it.
Single server
This setup works on our Apache server as well (without extra server for proxy) but it seems slower compared to adding an extra server )), while changing the ports in the config, where apache would listen on port 81 or 8080 and nginx on port 80 but ill try that.
Please make sure that u change port80=80 in directadmin.conf to the value wanted for Apache and restart httpd then, i needed to change it in /etc/httpd/conf/httpd.conf as well to get success
Pros: It does not need a lot of config, u can work as u are used to
Cons: Its not included in custombuild, u cant easily have custom configs if using external proxy
Im not that techie so i might get some comments but i welcome them, to me it seems a nice and clean way of doing it