ขอวิธีติดตั้ง Nginx บน Centos 5 แยก DA หน่อยครับ ขอบคุณครับ

ขอบคุณล่วงหน้าครับผม

เอิ่ม

    • มาแนวนี้อีกละ จ้างไปเลยครับ มีคนรอทำอยู่เพียบ 5555

อยากลองเซ็ทเองอะท่าน

ลองเซ็ทตามนี้แล้วมันไม่ทำงาน ไม่รู้ติดตรงไหน T _ T http://www.thaihostt…b8%87%e0%b8%ad/

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

yum install nginx

แล้วแก้ /etc/nginx/nginx.conf

แค่นี้แหละครับ

ลองเรียกผ่าน port 85 ได้หรือเปล่า ถ้าได้ ก็ลองดูตรงที่ iptables ว่าถูกต้องแล้วหรือยัง

ลงได้แว้วๆ 3 บรรทัดที่ไอซ์บอกจบเลย เหอๆๆๆๆๆ

#service nginx restart

Stopping nginx: [ OK ]

Starting nginx: /usr/sbin/nginx: /usr/local/lib/libpng12.so.0: no version information available (required by /usr/lib64/libgd.so.2)

                                                       [  OK  ]

มันมีปัญหาอะไรหรือเปล่าขึ้นยาวมากๆ เลยครับ ^ _ ^

ไม่มีอะไรฮะ มันเป็นบั๊กจาก lib ของ da

ครับผม ขอบคุณมากครับ ไอซ์

######## รายงานความคืบหน้าล่าสุด !!! #########

ลงเครื่องทดลองได้สำเร็จใช้ได้แล้ว

แต่เครื่องโฮสหลักลงแล้ว restart service ได้ปกติ

แต่เข้า http://domain.com:85 ไม่ได้ซะงั้น ไม่รู้เป็นที่อะไรครับ

ลงเหมือนกัน อีกเครื่องทดลองใช้ได้ซะงั้น

ตัวหลัก directadmin 1.3.5

ตัวทดลอง directadmin 1.4.0

มีผลอะไรหรือเปล่าครับ

ถ้าลง firewall เปิด port ด้วย

ปิด firewall แล้วเครื่องหลักก็ยังไม่ได้ครับ

งงอยู่แต่ restart service มันก็ขึ้นปกติเหมือนเครื่องทดลองครับ

แต่เครื่องทดลองใช้งานได้ครับ ลงเหมือนๆกัน T _ T

netstat -nltp

service iptables status

#netstat -nltp

tcp 0 0 202.170.120.xxx:85 0.0.0.0:* LIST

EN 19029/nginx.conf

#service iptables status

21 ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:85

ลอง off firewall CSF แล้วก็ยังไม่ทำงานครับ http://domain.com:85

ควรขยายความคำว่า ไม่ทำงาน ว่าเรียกแล้วเป็นอย่างไร

เรียกแล้วเข้าหน้าว่างๆขาวๆ

เรียกแล้วขึ้น error 500 403 …

เรียกแล้ว timeout

ลอง telnet ip 85 ดูว่าสามารถ connect ได้หรือเปล่้า

http://treehost.in.th:85 เรียกแล้ว time out ครับ

connect ได้ แต่ไม่ response คงต้องไปไล่ดู nginx.conf ครับ น่าจะมีอะไรผิด

ขอบคุณครับ เด๋วลองไล่ config ดูใหม่ครับ

user apache apache;



worker_processes 4; # Set it according to what your CPU have. 4 Cores = 4

worker_rlimit_nofile 8192;



pid /var/run/nginx.pid;



events {

worker_connections 1024;

}



http {

include mime.types;

default_type application/octet-stream;



log_format main '$remote_addr - $remote_user [$time_local] '

'"$request" $status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';



server_tokens off;

access_log /var/log/nginx/access.log main;

error_log  /var/log/nginx/error.log crit;



server_names_hash_bucket_size 64;

sendfile on;

tcp_nopush on;

tcp_nodelay off;

keepalive_timeout 30;

gzip on;

gzip_comp_level 9;

gzip_proxied any;



proxy_buffering on;

proxy_cache_path /etc/nginx/proxy_temp levels=1:2 keys_zone=one:15m inactive=7d max_size=1000m;

proxy_buffer_size 16k;

proxy_buffers 100 8k;

proxy_connect_timeout 60;

proxy_send_timeout 60;

proxy_read_timeout 60;



server {

listen 202.170.120.209:85 default rcvbuf=8192 sndbuf=16384 backlog=32000; # Real IP here

server_name domain.name _ ; # "_" is for handle all hosts that are not described by server_name

charset off;

access_log  off;

location / {

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_pass http://202.170.120.209; # Real IP here และไม่มี / ปิดท้าย

client_max_body_size 16m;

client_body_buffer_size 128k;

proxy_buffering on;

proxy_connect_timeout 90;

proxy_send_timeout 90;

proxy_read_timeout 120;

proxy_buffer_size 16k;

proxy_buffers 32 32k;

proxy_busy_buffers_size 64k;

proxy_temp_file_write_size 64k;

}



location ~* ^/(phpmyadmin|webmail|squirrelmail|uebimiau|roundcube)/.+\.(jpg|jpeg|gif|png|ico|css|zip|tar|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js|wmv|avi|cur|swf|mp3|wma|htc|cur)$ {

root /var/www/html/;

expires 30d;

access_log off;

}



location ~* ^/(stats)/.+\.(jpg|jpeg|gif|png|html|htm)$ {

root /var/www/html/;

access_log off;

}



location ~* ^/(mrtg|imrtg)/.+\.(jpg|jpeg|gif|png|html|htm)$ {

root /var/www/html/;

access_log off;

}



location /nginx_status {

stub_status on;

access_log off;

allow 202.170.120.209; # Real IP here

allow 127.0.0.1;

deny all;

}

if ($http_host = "") {

return 444;

}



}

# เพื่อไว้สำหรับคนที่จะแยกค่า conf นะครับ. ไฟล์ตามด้านล่างของผมคือไฟล์ว่างเปล่า

include /etc/nginx/etc/*.conf;

}