- دايرکت ادمين : يک کنترل پنل محبوب و ارزان قيمت لينوکسي براي سيستم عامل هاي Redhat,Redhast Enterprise,FreeBSD مي باشد
- Nginx ( Engine X) : يک سرور HTTP رايگان ، متن باز و بسيار کارآمد مي باشد که ميتواند به عنوان پروکسي معکوس و همچنين به عنوان يک پروکسي سرور IMAP/POP3 بکارگرفته شود
نکته :
در اين آموزش نشان خواهيم داد چگونه انجينکس را نصب نموده و آن را براي استفاده به همراه .پدايرکت ادمين پيکربندي نمائيم
البته افرادي که از دايرکت ادمين استفاده نمي کنند و از کنترل پنلهايي مانند cPanel,Kloxo و همچنين يک سرور لينوکسي بدون کنترل پنل که به عنوان وب سرور پيکربندي شده است استفاده مي نمايند مورد بهره برداري قرار گيرد
نصب Nginx
1. Download latest Nginx:
wget http://nginx.org/download/nginx-1.0.4.tar.gz
2. Extract tar file and move into the newly created directory:
tar -zxvf nginx-1.0.4.tar.gz
cd nginx-1.0.4
3. Configure:
./configure --sbin-path=/usr/local/sbin --with-http_ssl_module
make
make install
4. Test Run (Default) :
/usr/local/sbin/nginx
5. Open Browser and you will see “Welcome to nginx!”
killall nginx
1. Move to Nginx configuration dir
cd /usr/local/nginx/conf
2. Make backup current conf file
mv nginx.conf nginx.conf.bak
3. Create new nginx.conf
nano -w nginx.conf
4. Paste this configuration to your nginx.conf :
mkdir /usr/local/nginx/vhosts
6. Move to vhost dir
cd /usr/local/nginx/vhosts
7. Create vhosts file ( You can change to your own domain name/name )
pico -w lowkey.net.my
8. Paste this configuration ( **IP** : Please change to your server IP ):
server {
error_log /var/log/nginx/vhost-error_log warn;
listen **IP**:80;
server_name lowkey.net.my www.lowkey.net.my;
access_log /var/log/httpd/domains/lowkey.net.my.bytes bytes_log;
access_log /var/log/httpd/domains/lowkey.net.my.log combined;
root /home/lowkey/public_html;
location / {
location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
expires 7d;
try_files $uri @backend;
}
error_page 405 = @backend;
add_header X-Cache "HIT from Backend";
proxy_pass http://**IP**:8081;
include proxy.inc; # Refer step 9
}
location @backend {
internal;
proxy_pass http://**IP**:8081;
include proxy.inc; # Refer step 9
}
location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://**IP**:8081;
include proxy.inc; # Refer step 9
}
location ~ /\.ht {
deny all;
}
}
9. Create proxy.inc
touch /usr/local/nginx/conf/proxy.inc
cd /usr/local/nginx/conf/
pico -w proxy.inc
Paste this configuration :
proxy_connect_timeout 59s;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_buffer_size 64k;
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_pass_header Set-Cookie;
proxy_redirect off;
proxy_hide_header Vary;
proxy_set_header Accept-Encoding '';
proxy_ignore_headers Cache-Control Expires;
proxy_set_header Referer $http_referer;
proxy_set_header Host $host;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
10. Finish Configure as reverse proxy
Change Apache port 80 to 8081
We already configure Nginx listen to port 80 and now we need Apache listen to 8081
1. Locate and Edit httpd.conf
find / -name httpd.conf
/etc/httpd/conf/httpd.conf
/usr/local/directadmin/data/users/lowkey/httpd.conf
Here, I need reconfigure two httpd.conf files.
2. First httpd.conf
pico /etc/httpd/conf/httpd.conf
Change Listen 80 To Listen 8081
3. Second httpd.conf
pico /usr/local/directadmin/data/users/lowkey/httpd.conf
Change VirtualHost **IP**:80 To VirtualHost **IP**:8081
4. Restart Apache
service httpd restart
5. Now your Apache listen to port 8081
6. Finish change port to 8081
Run Nginx
Now, everything is ready.
1. Run Nginx
/usr/local/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
2. Done!
Now You’re done.