# wget "http://downloads.sourceforge.net/project/freetype/freetype2/2.4.8/freetype-2.4.8.tar.bz2?ts=1321515964&use_mirror=cdnetworks-kr-1" # tar xvfj freetype-2.4.8.tar.bz2 # cd freetype-2.4.8 # GNUMAKE="/usr/sfw/bin/gmake" ./configure # /usr/sfw/bin/gmake # /usr/sfw/bin/gmake install
# wget http://www.libgd.org/releases/gd-2.0.35.tar.bz2 # tar xvfj gd-2.0.35.tar.bz2 # cd gd-2.0.35 # ./configure ... Support for PNG library: yes Support for JPEG library: yes Support for Freetype 2.x library: yes Support for Fontconfig library: yes Support for Xpm library: yes Support for pthreads: yes .... # make # make install
# wget "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.bz2" # tar xvfj pcre-8.30.tar.bz2 # cd pcre-8.30 # ./configure \ --enable-utf8 \ --enable-unicode-properties \ --enable-pcregrep-libz \ --enable-pcregrep-libbz2 \ --enable-newline-is-anycrlf \ --enable-pcre16 # make # make install
# wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz # tar xvfz GeoIP.tar.gz # cd GeoIP-1.4.8 # CC=/usr/sfw/bin/gcc ./configure # make # make install
root@wl ~/src # wget http://nginx.org/download/nginx-1.0.12.tar.gz
root@wl ~/src # tar xvfz nginx-1.0.12.tar.gz
root@wl ~/src # cd nginx-1.0.12
root@wl ~/src/nginx-1.0.12 # CFLAGS="-fast -xipo -I/usr/local/include -I/usr/local/ssl/include src/os/unix/ngx_sunpro_x86.il" \
./configure \
--prefix=/usr/local/nginx \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-http_geoip_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_stub_status_module
1)
root@wl ~/src/nginx-1.0.12 # make
root@wl ~/src/nginx-1.0.12 # make install
1) Solaris Studio 로 컴파일 할때, ngx_atomic_fetch_add, ngx_atomic_cmp_set, ngx_cpu_pause을 못찾는 다는 메시지가 나오면서 컴파일을 진행할 수 없다. 빌드 스크립트의 문제인데, 아키텍처에 따라 포함되는 인라인 어셈블러 소스를 다르게 넣어야 한다. (src/os/unix/ngx_sunpro_*.il 중 하나) ngx_sunpro_x86.il 은 Solaris x86, 32bit 컴파일의 경우다.
root@wl ~ # vi /usr/local/nginx/conf/nginx.conf
...
http {
...
server {
...
# 문서의 루트를 정의. /usr/local/nginx/html
location / {
...
root html;
...
}
...
# Fast-CGI로 PHP와 연동한다.
location ~ \.php$ {
try_files $uri =404;
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
...
root@wl ~ #
root@wl ~ # mkdir /usr/local/geoip root@wl ~ # cd /usr/local/geoip root@wl /usr/local/geoip # wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz root@wl /usr/local/geoip # gunzip GeoIP.dat.gz root@wl /usr/local/geoip # wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz root@wl /usr/local/geoip # gunzip GeoLiteCity.dat.gznginx.conf 는 아래와 같은 설정을 추가한다.
root@wl ~ # vi /usr/local/nginx/conf/nginx.conf
...
http {
...
geoip_country /usr/local/geoip/GeoIP.dat;
geoip_city /usr/local/geoip/GeoLiteCity.dat;
...
map $geoip_country_code $ip_allow {
default yes;
cn no;
}
server {
...
if ($ip_allow = no) {
return 403;
}
}
}
root@wl ~ #
root@wl ~ # cat /usr/local/nginx/conf/nginx.conf
user nobody;
worker_processes 2;
error_log logs/error.log;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log logs/access.log;
sendfile on;
tcp_nopush on;
keepalive_timeout 5;
server_tokens off;
limit_zone zoneone $binary_remote_addr 10m;
gzip on;
gzip_comp_level 5;
gzip_http_version 1.0;
gzip_min_length 0;
gzip_types text/plain text/css image/x-icon application/x-javascript;
gzip_vary on;
geoip_country /usr/local/geoip/GeoIP.dat;
geoip_city /usr/local/geoip/GeoLiteCity.dat;
map $geoip_country_code $ip_allow {
default yes;
cn no;
}
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
client_header_buffer_size 64k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 16k;
proxy_buffers 32 16k;
proxy_busy_buffers_size 64k;
server {
listen 80;
server_name www.xxx.com;
access_log logs/www.xxx.com.access.log;
error_log logs/www.xxx.com.error.log debug;
location / {
proxy_pass http://localhost:81/;
limit_conn zoneone 10;
}
location = /_.gif {
empty_gif;
}
location /admin {
proxy_pass http://localhost:81/admin;
allow 127.0.0.1;
deny all;
}
location /images {
proxy_pass http://localhost:81/images;
expires max;
}
location /thumbimages {
proxy_pass http://localhost:81/images;
image_filter resize 150 100;
image_filter_buffer 1M;
image_filter_jpeg_quality 75;
error_page 415 = /_.gif;
}
location /share {
root /share/;
expires max;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
if ($ip_allow = no) {
return 403;
}
}
}
root@wl ~ #
root@wl ~ # /usr/local/nginx/sbin/nginx※ 실행한 후 http://localhost/ 을 보면 아래와 같은 화면이 나온다.

root@wl ~ # /usr/local/nginx/sbin/nginx -s stop
root@wl ~ # vi /usr/local/nginx/html/phpinfo.php
<?php phpinfo(); ?>
root@wl ~ # /etc/init.d/php-fpm start 1)
1) 이 스크립트는 윈디하나의 솔라나라: SAMP에서 PHP, PHP-FPM 설치및 설정 섹션에 설명했다.
nginx.sh | 다운로드 (776 바이트) |
#!/bin/sh
NGINX_BASE_DIR="/usr/local/nginx"
NGINX_DAEMON="${NGINX_BASE_DIR}/sbin/nginx"
NGINX_CONF="${NGINX_BASE_DIR}/conf/nginx.conf"
__launch_signal( ) {
${NGINX_DAEMON} -s ${1} &>/dev/null
}
__checkconfig( ) {
${NGINX_DAEMON} -c ${NGINX_CONF} -t &>/dev/null
}
__start( ) {
[ -r ${NGINX_CONF} ] || exit 1
__checkconfig && ${NGINX_DAEMON} -c ${NGINX_CONF} &>/dev/null || return ${?}
}
__stop( ) {
__launch_signal stop
}
__reload( ) {
__checkconfig && __launch_signar reload || return ${?}
}
__restart( ) {
__stop && __start
}
__show_usage( ) {
echo "Usage: ${0} {start|stop|restart|reload}"
exit 3
}
case "${1}" in
start|stop|restart|reload)
[ -x ${NGINX_DAEMON} ] || exit 2
__${1}
;;
*)
__show_usage
;;
esac
|
|
Copyright © 2004-2012 Jo HoSeok. All rights reserved. |