[Nginx]
- 웹 서버 소프트웨어로 아파치보다 가볍고, 높은 성능을 목표로함
- 아파치와 달리 요청, 응답을 비 동기 이벤트 기반 구조로하여 다수의 연결을 효과적으로 처리
- 대부분의 코어 모듈이 아파치보다 적은 리소스로 빠르게 동작하는 장점이 있어 차세대 웹서버로 불림
설치환경
centos 6
기존 서비스 중인 웹서비스는 모두 중지, php와 mysqld는 백업해놓기
1. nginx 설치
# cd /usr/local/src # yum -y install gcc* make cmake libxslt* libxml2* ncurses-devel libtool-ltdldevel openssl-devel pcre-devel ncurses-devel libxml2-devel bzip2-devel curl-devel gdbm-devel libjpeg-devel libpng-devel freetype-devel imap-devel libc-clientdevel krb5-devel libmcryptlibmcrypt-devel libmhash-devel flex icu libicu libicu-devel gd gd-devel openldap-devel # wget http://nginx.org/download/nginx-1.13.4.tar.gz # tar -zxvf nginx-1.13.4.tar.gz # cd nginx-1.13.4 # ./configure --prefix=/usr/local/nginx \ --conf-path=/usr/local/nginx/conf/nginx.conf \ --sbin-path=/usr/local/nginx/sbin/nginx \ --lock-path=/usr/local/nginx/nginx.lock \ --pid-path=/usr/local/nginx/nginx.pid \ --http-client-body-temp-path=/usr/local/nginx/tmp/body \ --http-proxy-temp-path=/usr/local/nginx/tmp/proxy \ --http-fastcgi-temp-path=/usr/local/nginx/tmp/fastcgi \ --http-uwsgi-temp-path=/usr/local/nginx/tmp/uwsgi \ --http-scgi-temp-path=/usr/local/nginx/tmp/scgi \ --http-log-path=/usr/local/nginx/logs/access.log \ --error-log-path=/usr/local/nginx/logs/error.log \ --with-http_addition_module \ --with-http_degradation_module \ --with-http_flv_module \ --with-http_gzip_static_module \ --with-http_image_filter_module \ --with-http_mp4_module \ --with-http_random_index_module \ --with-http_ssl_module \ --with-http_stub_status_module \ --with-http_sub_module \ --with-http_realip_module \ --with-http_xslt_module \ --with-http_dav_module \ --with-http_auth_request_module \ --user=nobody \ --group=nobody # make && make install |
2. nginx 데몬 수정
# vi /etc/init.d/nginx \\ 설치 완료 후 실행스크립트 작성, 아래 스크립트를 /etc/init.d/nginx파일 생성 후 해당 파일에 써줌
# /etc/init.d/nginx start |
* 오류발생
**오류** # /etc/init.d/nginx start bash: /etc/init.d/nginx: 허가 거부 **해결방법** # ls -l /etc/init.d/nginx -rw-r--r-- 1 root root 1591 2017-09-14 09:46 /etc/init.d/nginx # chmod 755 /etc/init.d/nginx \\ 스크립트 실행권한주기 **오류** # /etc/init.d/nginx restart nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: [emerg] mkdir() "/usr/local/nginx/tmp/body" failed (2: No such file or directory) nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed **해결방법** /usr/local/nginx/tmp 가 없다고 뜸 # cd /usr/local/nginx/ # mkdir tmp # /etc/init.d/nginx start Starting nginx: [ OK ] 설치완료!! |
3. 서비스 확인
# netstat -nltp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 15539/nginx # ps -ef |grep nginx root 15539 1 0 10:19 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf nobody 15541 15539 0 10:19 ? 00:00:00 nginx: worker process root 15544 15504 0 10:20 pts/0 00:00:00 grep nginx |
'서버 & 시스템 > Linux' 카테고리의 다른 글
curl 설치 및 http2 적용 (0) | 2018.04.17 |
---|---|
각종 서비스 포트번호 확인 (0) | 2018.03.27 |
MySQL 업그레이드 (5.1 → 5.6) (0) | 2018.01.15 |
Mysql 언어셋 변경 (utf8 → euckr) (0) | 2018.01.11 |
vsftpd 설치 및 설정 (1) | 2017.11.27 |