Инсталляция Nginx как прокси сервера http на Centos 6.5 из пакетов
-- ### NGINX REPO
# rpm -Uvh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
# yum install -y nginx \
links \
curl
# chkconfig nginx on
# service nginx restart
# vi /etc/hosts
192.168.1.201 proxyserv.local proxyserv
192.168.1.202 webserv.local webserv
-- Apache работает на сервере 192.168.1.202 и слушает порт 8080
# curl -I http://192.168.1.202:8080
HTTP/1.1 200 OK
Date: Sun, 13 Apr 2014 08:18:43 GMT
Server: Apache/2.4.3 (Unix) PHP/5.4.10
X-Powered-By: PHP/5.4.10
Content-Type: text/html; charset=UTF-8
# cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.orig
# mkdir -p /etc/nginx/sites-enabled/
# cat > /etc/nginx/conf.d/default.conf << EOF
include /etc/nginx/sites-enabled/*.conf;
EOF
# cat > /etc/nginx/sites-enabled/sysadm.ru.conf << 'EOF'
## Basic reverse proxy server ##
## Apache backend for www.sysadm.ru ##
upstream apachewebserver {
server 192.168.1.202:8080; #Apache
}
## Start www.sysadm.ru ##
server {
listen 192.168.1.201:80;
server_name sysadm.ru;
access_log /var/log/nginx/log/sysadm.ru.access.log main;
error_log /var/log/nginx/log/sysadm.ru.error.log;
root /usr/share/nginx/html;
index index.html index.htm;
## send request back to apache1 ##
location / {
proxy_pass http://apachewebserver;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
## End www.sysadm.ru ##
EOF
-- proxy_pass http://apachewebserver;
Как то не на что не влияет. Может недостаточно разобрался.
# mkdir -p /var/log/nginx/log/
# service nginx restart
# links sysadm.ru