본문 바로가기

Nginx4

에러페이지 (404, 500, 502, 503, 504) 발생시 특정페이지로 보내기 에러페이지 (404, 500, 502, 503, 504) 발생시 특정페이지로 보내는 설정방법 vi default.conf or default_ssl.conf server { ... location / { proxy_intercept_errors on; proxy_pass http://localhost:8090/; -> 해당도메인의포트로 요청시 conf에 설정된 포트로 리다이렉팅 해주는 설정 } error_page 404 500 502 503 504 /idnex.html; location = /index.html { root /index.html파일이 위치한곳; internal; } 이러면 설정해놓은 파일로 잘 넘어간다. 2019. 11. 27.
http를 https로 리다이렉팅 시키기 환경 80포트 설정과 443(SSL)포트 conf 파일을 따로 만들어놨다. 80 - default.conf 443 - default_ssl.conf server { listen 80; server_name www.도메인명 도메인명; root /웹경로 return 301 https://$server_name$request_uri; --> 해당줄 추가 access_log /var/log/httpd/도메인.access.log main; error_log /var/log/httpd/도메인.error.log warn; access_log syslog:server=unix:/dev/log,facility=local4,tag=nginx,severity=info main; error_log syslog:server=u.. 2019. 10. 31.
nginx 포트 proxy 설정 상황 - 한 서버에 nginx, 스프링부트를 올려야 하는 상황 - nginx, 스프링부트 둘다 80포트 사용하기 때문에 포트 충돌 설정 - 스프링부트의 포트를 변경하고, nginx 설정에서 변경된포트로 통신 후 웹출력은 nginx가 해주는 방식이다. - jar파일이 서버에서 싱행중이어야 한다. - default.conf 에 설정한다 (각 서버마다 도메인 설정하는 부분이 다르기때문에 상황에 맞게 설정할것) # vi default.conf server { listen 80; server_name 도메인; root /웹경로 access_log /var/log/access-로그파일명 main; error_log /var/log/httpd/error-로그파일명 warn; access_log syslog:serve.. 2019. 10. 30.
centos7 nginx 설치 1. nginx 저장소 추가 # vi /etc/yum.repos.d/nginx.repo [nginx] name=nginx repo baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/ gpgcheck=0 enabled=1 * OS, OSRELEASE 부분에 상황에 맞게 수정해준다 ex) centos/7/ 2. nginx 설치 # yum -y install nginx 3. 방화벽 설정 # firewall-cmd --permanent --zone=public --add-service=http # firewall-cmd --permanent --zone=public --add-service=https # firewall-cmd --reload 4. nginx .. 2019. 10. 22.