centos5 yum nginx tomcat apache

1. fedora 원본 사용
2. nginx 설치
3. 테스트 프로필
4. 프로필 편집
5. nginx 시작
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install nginx
nginx -t
vim /etc/nginx/nginx.conf
service nginx start
[root@mail nginx]# cat /etc/nginx/nginx.conf

user              nginx;
worker_processes  2;

error_log  /var/log/nginx/error.log;

pid        /var/run/nginx.pid;


worker_rlimit_nofile 65535;

events {
    worker_connections  65535;
}

http {
    include       /etc/nginx/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"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    keepalive_timeout  65;

    upstream tomcat {
        server localhost:8081;
    }
    upstream apache {
        server localhost:8088;
    }

    server {
        listen       80 default;
        server_name  _;

        location / {
            root   /usr/share/nginx/html;
            index  index.jsp index.html index.htm;
                proxy_redirect 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;
                proxy_pass http://tomcat;
        }

    }
        server{

                listen 80;
                server_name angroid.com on-z.com;
                location / {
                        proxy_redirect 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;
                        proxy_pass http://apache;
                }

        }

    # Load config files from the /etc/nginx/conf.d directory
    include /etc/nginx/conf.d/*.conf;

}


iptables 설정
iptables -I INPUT -p tcp -s 0/0 --dport 80 -j ACCEPT
iptables -I OUTPUT -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT

좋은 웹페이지 즐겨찾기