Please assign a menu to the primary menu location under menu

Nginx

Set up nginx as a reverse proxy to node.js

– nginx.conf http { …… upstream backend { server 127.0.0.1:1337; } …… server { listen 80; server_name example.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://backend/; proxy_redirect off; } } – node.js # cd /usr/local/src # wget http://nodejs.org/dist/v0.8.1/node-v0.8.1.tar.gz # tar xzvf node-v0.8.1.tar.gz # cd node-v0.8.1 # ./configure –prefix=/usr/local/node.js && make && make install # echo ‘PATH=$PATH:/usr/local/node.js’ >> ~/.bash_profile && export PATH # nano /home/ruo91/node.js/app.js var http = require(‘http’); http.createServer(function (req, res){ res.writeHead(200, {‘Content-Type’: ‘text/plain’}); res.end(‘Hello Worldn’); }).listen(1337, ‘127.0.0.1’); console.log(‘Server running at http://127.0.0.1:1337’); # node /home/ruo91/node.js/app.js Server running at http://127.0.0.1:1337 -test #

Nginx – the size 10485760 of shared memory zone “tmpcache” conflicts with already declared size 0

Nginx의 Proxy cache(cache_purge module)를 사용하여 공유 메모리를 사용하려니 아래와 같은 오류 메세지가 떴습니다. # nginx -t nginx: the size 10485760 of shared memory zone “tmpcache” conflicts with already declared size 0 in /usr/local/etc/nginx/nginx.conf:96   이 경우는 proxy_cache_path 가 proxy_pass 보다 뒤에 있을때 발생합니다. proxy_pass http://127.0.0.1:8000; proxy_cache_path /tmp/cache levels=1:2 keys_zone=tmpcache:10m inactive=30m max_size=2g; # nginx -t nginx: the size 10485760 of shared memory zone “tmpcache” conflicts with already declared size 0 in /usr/local/etc/nginx/nginx.conf:96   그러므로 proxy_cache_path 다음으로 proxy_pass가 와야 오류가 발생하지 않습니다. proxy_cache_path /tmp/cache levels=1:2 keys_zone=tmpcache:10m inactive=30m max_size=2g; proxy_pass http://127.0.0.1:8000; # nginx -t nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx:

CentOS – How to install nginx

CentOS 리눅스에서 Nginx를 설치하는 방법입니다. 설치는 매우 간단합니다. nginx 저장소 파일을 하나 만들고 아래처럼 추가 해줍니다. # nano /etc/yum.repos.d/nginx.repo name=nginx repo baseurl=http://nginx.org/packages/centos/6/$basearch/ gpgcheck=0 enabled=1 Nginx를 설치하고 실행도 시켜줍니다. # yum install nginx # service nginx start nginx (을)를 시작 중:                                      설정 파일이 /etc/nginx에 있으므로 사용자 환경에 맞도록 설정 하시면 되겠습니다. 참고 http://nginx.org/en/download.html

Nginx – “-” 400 0 “-” “-“

nginx로 웹서버를 운영중인데.. 아래와 같은 로그들이 수도없이 기록이 되었습니다. 202.229.106.240 – – “-” 400 0 “-” “-” 115.238.47.229 – – “-” 400 0 “-” “-” 180.235.97.235 – – “-” 400 0 “-” “-” 202.215.229.12 – – “-” 400 0 “-” “-” 219.94.191.99 – – “-” 400 0 “-” “-” 219.87.170.130 – – “-” 400 0 “-” “-” 122.112.3.68 – – “-” 400 0 “-” “-” 222.145.124.194 – – “-” 400 0 “-” “-” 118.67.79.22 – – “-” 400 0 “-” “-” RFC2616을 보면 400 에러는 Bad Request 로 클라이언트의 잘못된 요청으로 처리할 수 없는 문제라고 합니다. nginx.conf 설정파일에 아래의 가상호스트설정

Nginx – autoindex css

Nginx 에서 autoindex 옵션이 on으로 설정되어 있는 경우 index 페이지가 없으면 아래 그림처럼 보여줍니다. 아파치에서는 autoindex 로 설정이 가능하지만 Nginx 에서는 설정이 불가능한걸로 보이길래.. 구글링하다 외국 블로그에서 패치 방법을 찾았습니다. Nginx 소스 디렉토리의 ngx_http_autoindex_module.c 소스에 3가지 static u_char title, static u_char header, static u_char tail 부분을 적절하게 수정하고 컴파일 하면 됩니다. 패치 적용 # cd /usr/local/src # wget http://nginx.org/download/nginx-1.2.7.tar.gz # tar xzvf nginx-1.2.7.tar.gz # cd nginx-1.2.7 # wget http://mirror.yongbok.net/ruo91/nginx/patch/ngx_http_autoindex_module.c.patch # patch -p0 < ngx_http_autoindex_module.c.patch Hmm… Looks like a unified diff to me… The text leading up to this was: ————————– |— src/http/modules/ngx_http_autoindex_module.c 2010-05-24 21:35:10.000000000 +0900 |+++ src/http/modules/ngx_http_autoindex_module.c.orig 2010-09-22 16:03:39.000000000 +0900  

1 2 3