레이블이 nginx인 게시물을 표시합니다. 모든 게시물 표시
레이블이 nginx인 게시물을 표시합니다. 모든 게시물 표시

2014년 1월 2일 목요일

RHEL6 / Centos6 에서 Yum 으로 Nginx 설치하기

Step #1: nginx 저장소 설치하기

Type the following wget command to install nginx yum configuration file:
# cd /tmp
CentOS Linux v6.x user type the following command:
# wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
# rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm

RHEL v6.x user type the following command:
# wget http://nginx.org/packages/rhel/6/noarch/RPMS/nginx-release-rhel-6-0.el6.ngx.noarch.rpm
# rpm -ivh nginx-release-rhel-6-0.el6.ngx.noarch.rpm

Sample outputs:
warning: nginx-release-rhel-6-0.el6.ngx.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
Preparing...                ########################################### [100%]
   1:nginx-release-rhel     ########################################### [100%]

Step #2: nginx 설치하기

Type the following yum command to install nginx web-server:
# yum install nginx
Sample outputs:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.tt.co.kr
 * extras: centos.tt.co.kr
 * updates: centos.tt.co.kr
nginx                                                                                                        | 2.9 kB     00:00     
nginx/primary_db                                                                                             |  25 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 0:1.4.4-1.el6.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
 Package                     Arch                         Version                                 Repository                   Size
====================================================================================================================================
Installing:
 nginx                       x86_64                       1.4.4-1.el6.ngx                         nginx                       311 k

Transaction Summary
====================================================================================================================================
Install       1 Package(s)

Total download size: 311 k
Installed size: 770 k
Is this ok [y/N]: Y
Downloading Packages:
nginx-1.4.4-1.el6.ngx.x86_64.rpm                                                                             | 311 kB     00:01     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : nginx-1.4.4-1.el6.ngx.x86_64                                                                                     1/1 
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* http://nginx.org/en/docs/

Commercial subscriptions for nginx are available on:
* http://nginx.com/products/

----------------------------------------------------------------------
  Verifying  : nginx-1.4.4-1.el6.ngx.x86_64                                                                                     1/1 

Installed:
  nginx.x86_64 0:1.4.4-1.el6.ngx                                                                                                    

Complete!
 

Step #3: nginx 서비스 등록

Type the following command:
# chkconfig nginx on

How do I start / stop / restart nginx web-server?

Type the following commands:
# service nginx start
# service nginx stop
# service nginx restart
# service nginx status
# service nginx reload

Step #4: 설정파일

  1. Default configuration directory: /etc/nginx/
  2. Default SSL and vhost config directory: /etc/nginx/conf.d/
  3. Default log file directory: /var/log/nginx/
  4. Default document root directory: /usr/share/nginx/html
  5. Default configuration file: /etc/nginx/nginx.conf
  6. Default server access log file: /var/log/nginx/access.log
  7. Default server access log file: /var/log/nginx/error.log
To edit the nginx configuration file, enter:
# vi /etc/nginx/nginx.conf
Set or update worker_processes as follows (this must be set to CPU(s) in your system. Use thelscpu | grep '^CPU(s)' command to list the number of CPUs in the server)
worker_processes  2;
Turn on gzip support:
gzip  on;
Save and close the file. Edit the file /etc/nginx/conf.d/default.conf, enter:
# vi /etc/nginx/conf.d/default.conf
Set IP address and TCP port number:
    listen       202.54.1.1.1:80;
Set server name:
    server_name  www.cyberciti.biz;
Save and close the file. Start the server:
# service nginx start
Verify that everything is working:
# netstat -tulpn | grep :80
# ps aux | grep nginx

방화벽 설정: TCP 80 포트 오픈

Edit the file /etc/sysconfig/iptables, enter:
# vi /etc/sysconfig/iptables
Add the following lines, ensuring that they appear before the final LOG and DROP lines for the INPUT chain to open port 80:
 
-A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
 
Save and close the file. Finally, restart the firewall:
# service iptables restart

참조 : http://www.cyberciti.biz/faq/install-nginx-centos-rhel-6-server-rpm-using-yum-command/

요즘 CentOS의 재미에 푹 빠져있다.

지금까지 개발자로써 너무 안이하게 살았던 거 같다

회사업무에만 신경쓰다보니 신기술 경향, 자기개발 등에 너무 신경쓰지 않았나 싶다.

그래서 부랴부랴 호스팅, 도메인도 신청하고 apache + tomcat만 했던 내 자신을 반성하고
최근 떠오르는 nginx, jetty, github, cordova, (+ spring3.0, mybatis, struts) 공부 겸
취미로 사이트 하나도 구축할 생각이다.

개인적으로 관리하는 소스들은 사내 저장소나 개인 하드에 보관하였는데,
이번기회에 개인 호스팅을 이용한 형상관리도 같이 해볼예정이다.

원래 우분투를 해볼까도 했지만,
웹개발자 베이스에서는 역시 레드햇계열을 만지는게 좋을 거 같아서 CentOS로 하기로 했다.

요즘 뜨는 리눅스는 민트인데 -_ -, SE도 아닌 내가 만지기엔 조금 무리가 있다고 생각이 든다.

이제부터 리눅스에 ngix, jetty, github 등을 CentOS 6.x 기반에 설치할 예정인데,
그와 관련된 것과 새로 만드는 사이트에 대한 포스팅이 주가 될 듯하다.