"Nginx"의 두 판 사이의 차이
잔글 |
잔글 |
||
144번째 줄: | 144번째 줄: | ||
|- | |- | ||
| style="background-color: rgb(241, 241, 241);" | | | style="background-color: rgb(241, 241, 241);" | | ||
− | include /etc/nginx/conf.d/*.conf;<br/> include /etc/nginx/sites-enabled/*; #--- 이 라인을 추가 합니다. | + | include /etc/nginx/conf.d/*.conf;<br/> include /etc/nginx/sites-enabled/*.conf; #--- 이 라인을 추가 합니다. |
+ | |} | ||
+ | |||
+ | |||
+ | vi /etc/nginx/conf.d/default.conf | ||
+ | |||
+ | {| cellspacing="1" cellpadding="1" style="line-height: 20.7999992370605px; color: rgb(0, 0, 0); font-family: sans-serif; width: 771px;" | ||
+ | |- | ||
+ | | style="background-color: rgb(241, 241, 241);" | | ||
+ | server_name nouse.ossbiz.co.kr; | ||
|} | |} | ||
152번째 줄: | 161번째 줄: | ||
− | vi /etc/nginx/sites-available/ | + | vi /etc/nginx/sites-available/ossnode101.conf |
{| cellspacing="1" cellpadding="1" style="line-height: 20.7999992370605px; color: rgb(0, 0, 0); font-family: sans-serif; width: 771px;" | {| cellspacing="1" cellpadding="1" style="line-height: 20.7999992370605px; color: rgb(0, 0, 0); font-family: sans-serif; width: 771px;" | ||
162번째 줄: | 171번째 줄: | ||
location ~ \.php$ {<br/> try_files $uri =404;<br/> include /etc/nginx/fastcgi_params;<br/> fastcgi_pass 127.0.0.1:9000;<br/> fastcgi_index index.php;<br/> fastcgi_param SCRIPT_FILENAME /srv/www/mysite/public_html$fastcgi_script_name;<br/> }<br/>} | location ~ \.php$ {<br/> try_files $uri =404;<br/> include /etc/nginx/fastcgi_params;<br/> fastcgi_pass 127.0.0.1:9000;<br/> fastcgi_index index.php;<br/> fastcgi_param SCRIPT_FILENAME /srv/www/mysite/public_html$fastcgi_script_name;<br/> }<br/>} | ||
− | |||
− | |||
|} | |} | ||
174번째 줄: | 181번째 줄: | ||
|- | |- | ||
| style="background-color: rgb(241, 241, 241);" | | | style="background-color: rgb(241, 241, 241);" | | ||
− | ln -s /etc/nginx/sites-available/ | + | ln -s /etc/nginx/sites-available/<span style="line-height: 20.7999992370605px;">ossnode101.conf</span> /etc/nginx/sites-enabled/<span style="line-height: 20.7999992370605px;">ossnode101.conf</span> |
+ | |} | ||
− | |||
+ | vi /srv/www/mysite/public_html/phpinfo.php | ||
+ | {| cellspacing="1" cellpadding="1" style="line-height: 20.7999992370605px; color: rgb(0, 0, 0); font-family: sans-serif; width: 771px;" | ||
+ | |- | ||
+ | | style="background-color: rgb(241, 241, 241);" | | ||
+ | aaa | ||
+ | |} | ||
+ | nginx를 재기동 합니다. | ||
− | + | {| cellspacing="1" cellpadding="1" style="line-height: 20.7999992370605px; color: rgb(0, 0, 0); font-family: sans-serif; width: 771px;" | |
+ | |- | ||
+ | | style="background-color: rgb(241, 241, 241);" | | ||
+ | service php-fpm restart | ||
+ | service nginx restart | ||
+ | |} | ||
− | + | <span style="color: rgb(0, 0, 0); font-family: sans-serif; line-height: 19.0499992370605px;">브라우저에서 </span>[http://ossnode101.ossbiz.co.kr/ http://ossnode101.ossbiz.co.kr:80/phpinfo.php]<span style="color: rgb(0, 0, 0); font-family: sans-serif; line-height: 19.0499992370605px;"> 으로 접속 합니다.</span> | |
== Java 사용 설정 == | == Java 사용 설정 == |
2014년 9월 18일 (목) 16:00 판
비동기 이벤트 기반의 Web Server인 nginx를 정리 합니다.
- 홈페이지 : http://www.nginx.net/
- 다운로드 :
- 라이선스 :
- 플랫폼 : C
nginx 개요
CentOS 6.5에서 설치
Nginx 저장소 생성
vi /etc/yum.repos.d/nginx.repo
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1 |
Nginx 설치
yum install nginx |
Nginx 설정 파일
- /etc/nginx/ : 설정 파일 폴더
- nginx.conf
- conf.d/
- /var/log/nginx/ : 로그 폴더
- access.log
- error.log
- /usr/share/nginx/html/ : Document Root 폴더
기본 설정
vi /etc/nginx/nginx.conf
worker_processes 1; #--- core 수만큼 지정 gzip on; |
vi /etc/nginx/conf.d/default.conf
server_name ossnode101.ossbiz.co.kr; |
방화벽 설정 및 서비스 기동
setup #--- 방화벽에서 80/tcp port를 오픈 합니다. service nginx restart |
브라우저에서 http://ossnode101.ossbiz.co.kr:80/ 으로 접속 합니다.
PHP 사용 설정
PHP를 설치 합니다.
yum install php php-* mkdir /var/lib/php/upload |
vi /etc/php.ini
date.timezone = Asia/Seoul |
PHP-FPM 서비스를 실행 합니다
service php-fpm restart |
Site를 설정 합니다.
mkdir -p /srv/www/mysite/public_html mkdir /etc/nginx/sites-available |
vi /etc/nginx/nginx.conf
include /etc/nginx/conf.d/*.conf; |
vi /etc/nginx/conf.d/default.conf
server_name nouse.ossbiz.co.kr; |
vi /etc/nginx/sites-available/ossnode101.conf
server { location / { location ~ \.php$ { |
sites-enabled에 mysite를 추가 합니다.
ln -s /etc/nginx/sites-available/ossnode101.conf /etc/nginx/sites-enabled/ossnode101.conf |
vi /srv/www/mysite/public_html/phpinfo.php
aaa |
nginx를 재기동 합니다.
service php-fpm restart service nginx restart |
브라우저에서 http://ossnode101.ossbiz.co.kr:80/phpinfo.php 으로 접속 합니다.