เพิ่มเติมให้สมบูรณ์
แบบลัดอีกหน่อย
cd /usr/local/directadmin/scripts/custom
echo “echo “/usr/local/directadmin/scripts/nginx_direct.sh -u $username” >> /usr/local/nginx/etc/task.nginx” > domain_create_post.sh;
echo “echo “/usr/local/directadmin/scripts/nginx_direct.sh -u $username” >> /usr/local/nginx/etc/task.nginx” > domain_destroy_post.sh;
echo “echo “/usr/local/directadmin/scripts/nginx_direct.sh -u $username” >> /usr/local/nginx/etc/task.nginx” > domain_pointer_create_post.sh;
echo “echo “/usr/local/directadmin/scripts/nginx_direct.sh -u $username” >> /usr/local/nginx/etc/task.nginx” > domain_pointer_destroy_post.sh;
echo “echo “/usr/local/directadmin/scripts/nginx_direct.sh -u $username” >> /usr/local/nginx/etc/task.nginx” > subdomain_create_post.sh;
echo “echo “/usr/local/directadmin/scripts/nginx_direct.sh -u $username” >> /usr/local/nginx/etc/task.nginx” > subdomain_destroy_post.sh;
echo “echo “/usr/local/directadmin/scripts/nginx_direct.sh -u $username” >> /usr/local/nginx/etc/task.nginx” > user_create_post.sh;
#สร้างไฟล์ nginx_sub.conf
vi /usr/local/directadmin/data/templates/custom/nginx_sub.conf
server {
listen |IP|:85;
server_name |SUB|.|DOMAIN| www.|SUB|.|DOMAIN|;
access_log /var/log/httpd/domains/|DOMAIN|.|SUB|.log main;
error_log /var/log/httpd/domains/|DOMAIN|.|SUB|.error.log error;
location / {
proxy_pass http://|IP|;
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;
proxy_connect_timeout 60;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 120 64k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
location @back {
proxy_pass http://|IP|;
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;
}
#Static files location
location ~* ^.+\.(jpg|jpeg|gif|mp3|png|avi|vob|mpg|mpeg|mp4|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$ {
root |HOME|/domains/|DOMAIN|/public_html/|SUB|;
expires 14d;
error_page 404 = @back;
}
}
สร้างโฟลเดอร์
mkdir /var/run/nginx/
mkdir /usr/local/nginx/etc/
สร้างไฟล์เปล่า ชื่อ virtual.conf
vi /usr/local/nginx/etc/virtual.conf
สร้างโฟลเดอร์ log
mkdir /var/log/nginx
สร้างไฟล์เปล่า log
/var/log/nginx/error_log
### ถ้าใช้ apf ก็เพิ่ม rule เพิ่ม port 85
vi /etc/apf/conf.apf
#Ports for No Delay
TOS_16="…,85"
#และภายใน inbound
IG_TCP_CPORTS="…,85"
#ถ้าภายนอก access port 85 ได้เลย
#ก็เพิ่ม port 85 ที่ outbound ด้วย
EG_TCP_CPORTS="…,85"
#Restart apf
/etc/init.d/apf restart
ก็จะติดตั้งสมบูรณ์ครับ