1. Nginx 의 Upstream 기능 추가
[root@rtls ~]# vi /etc/nginx/sites-available/flyyunha.conf
upstream upstream-flyyunha-server {
server localhost:8311; #8301로 들어온 요청을 8311, 8321 로 보내주는 설정
server localhost:8321;
keepalive 1000;
}
server {
listen 8301; #Listen Port 8301
client_max_body_size 10M;
server_name 192.168.1.1; #해당 서버 IP
charset utf-8;
#charset koi8-r;
#access_log /data/logs/nginx_log/api_log/host.access.log main;
location / {
proxy_pass http://upstream-flyyunha-server; #해당 서버 IP 의 Tomcat 포트 8016
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
'Work > Nginx' 카테고리의 다른 글
Linux ( CentOS 7 ) 환경 에서 Nginx 설치 (0) | 2020.04.14 |
---|