Answer the question
In order to leave comments, you need to log in
How to use the nginx - apache bundle on a working site as a proxy?
Please tell me, on the site domain.ru with ip 1.1.1.1 there was apache 2.2 and in the config there were such lines
ProxyRequests On
ProxyVia Block
AllowCONNECT 21 25 110 443 22 554 563 5190 1080 8080 5140 5160 4000 1478 1479 1480 8008 Deny
Order 1478 1479 1480 8008
deny from all
allow from xxx.xx.xx.xx
Apache worked as a proxy. But there was a need to install nginx.
nginx config
# user nginx;
worker_processes 4;
timer_resolution 100ms;
# error_log /dev/null;
error_log /usr/local/nginx/logs/error.log crit;
#pid logs/nginx.pid;
worker_rlimit_nofile 200000;
worker_priority -5;
events { worker_connections 4000;
multi_accept on; }
http { include mime.types; default_type application/octet-stream;
types { text/plain data; }
log_format main '$remote_addr - $remote_user [$time_local] $host $request
'
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_src_client_ip"';
#access_log /usr/local/nginx/logs/access.log main;
access_log off;
# Caches information about open FDs, freqently accessed files.
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_min_length 10240;
gzip_buffers 64 8k;
gzip_comp_level 3;
gzip_http_version 1.1;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plan application/xml application/x-javascript text/css text/xml text/javascript;
gzip_disable "msie6";
client_body_timeout 10;
client_header_timeout 10;
send_timeout 2;
keepalive_timeout 30;
keepalive_requests 1000;
server_tokens off;
server_names_hash_bucket_size 64;
proxy_buffers 100 64k;
proxy_read_timeout 300;
proxy_send_timeout 300;
client_max_body_size 1500m;
reset_timedout_connection on;
proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=one:16m inactive=7d max_size=1024m;
proxy_temp_path /var/cache/nginx/temp;
server {
listen *:80;
server_name *.com;
location /nginx_status { stub_status on; access_log off; allow 1.1.1.1; deny all; }
location /munin { alias /var/www/html/munin; autoindex on; auth_basic "Munin"; auth_basic_user_file /etc/munin/munin-htpasswd; }
location / {
proxy_pass http://1.1.1.1:8181;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
server {
listen *:80;
server_name www.domain.ru domain.ru;
location /nginx_status { stub_status on; access_log off; allow 1.1.1.1; deny all; }
location /munin { alias /var/www/html/munin; autoindex on; auth_basic "Munin"; auth_basic_user_file /etc/munin/munin-htpasswd; }
# proxy_temp_path /var/cache/nginx/domain.ru;
location / {
# $host='domain.ru:80'
proxy_pass http://1.1.1.1:80;
proxy_set_header Host domain.ru;
proxy_redirect off;
}
# location /administrator {
location ~*(administrator|comprofiler)* {
proxy_cache off;
proxy_pass http://1.1.1.1:8181;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
}
Answer the question
In order to leave comments, you need to log in
Nginx is not a proxy in the usual sense. Those. it cannot be made to work in your case in the same way as Apache.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question