النتائج 1 إلى 6 من 6

الموضوع: How to Install Nginx with Cpanel Apache as proxy mode

  1. #1

    How to Install Nginx with Cpanel Apache as proxy mode



    السلام عليكم ورحمة الله وبركاته :

    الموضوع مناسب للسرفرات التي تعاني من ضغط شديد أثناء التصفح وتمت تجربته علي أكثر من

    سرفر بواسطتي وقمت بكتابة الموضوع من أجل أن تعم الفائدة علي أصحاب السرفرات :


    How to install Nginx web server in Cpanel to manage static content using less cpu and

    ram, so we just loaded PHP to Apache. Basically it will lower your memory usage and increase the speed of your server.

    It is currently running on this server, here is the info so you can see it works with the latest release of WHM\cPanel – cPanel 11.26.16, CentOS 5.5 i686, PHP 5.3.4 and Apache 2.2.17.

    - Run SSH console



    cd /usr/src
    wget http://sysoev.ru/nginx/nginx-0.7.63.tar.gz
    wget http://stderr.net/apache/rpaf/downlo...paf-0.6.tar.gz
    wget http://autosetup1.googlecode.com/files/pcre-7.9.tar.gz
    tar xvzf mod_rpaf-0.6.tar.gz
    cd mod_rpaf-0.6
    /usr/local/apache/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
    cd /usr/src
    tar xvzf pcre-7.9.tar.gz
    cd pcre-7.9
    ./configure
    make
    make install
    cd /usr/src
    tar xvzf nginx-0.7.63.tar.gz
    cd nginx-0.7.63
    ./configure --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module
    make
    make install

    Login to WHM and look for the following route:
    Main >> Service Configuration >> Apache Setup > Include Editor > Pre Main Include – Add the following configuration and save, LIST_OF_YOUR_IPS changing the IP to your server ip

    LoadModule rpaf_module modules/mod_rpaf-2.0.so
    RPAFenable On
    # Enable reverse proxy add forward
    RPAFproxy_ips 127.0.0.1 LIST_OF_YOUR_IPS
    # which ips are forwarding requests to us
    RPAFsethostname On
    # let rpaf update vhost settings
    # allows to have the same hostnames as in the "real"
    # configuration for the forwarding Apache
    RPAFheader X-Real-IP
    # Allows you to change which header mod_rpaf looks
    # for when trying to find the ip the that is forwarding
    # our requests

    Change the apache port to 81 (tweak settings)
    Open whm – tweak settings and find 0.0.0.0:80 and change it to 0.0.0.0.:81

    Run SSH console

    /usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings
    /scripts/rebuildhttpdconf
    httpd restart

    wget http://www.stop4host.com/downloads/nginx/nginx.sh

    chmod the file and run it

    chmod 755 nginx.sh
    ./nginx.sh

    Check the configuration

    /usr/local/nginx/sbin/nginx -t

    Start nginx

    /usr/local/nginx/sbin/nginx

    Until now only the managing nginx connections, but is not serving static content. For the latter you must edit the following file:

    /usr/local/nginx/conf/vhost.conf

    Remove the 3 # signs of the following lines:

    #location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
    # root /home/myweb/public_html;
    #}

    so the final configuration will looks like

    location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
    root /home/myweb/public_html;
    }

    Restart nginx in SSH

    /usr/local/nginx/sbin/nginx -s reload

    Also add it in /etc/init.d/ to make automatically start when you reboot your server

    nano /etc/init.d/nginx
    chmod 755 /etc/init.d/nginx

    #!/bin/sh
    #
    # nginx ... this script starts and stops the nginx daemon
    #
    # chkconfig: - 85 15
    # description: Nginx is an HTTP(S) server, HTTP(S) reverse \
    # proxy and IMAP/POP3 proxy server
    # processname: nginx
    # config: /opt/nginx/conf/nginx.conf
    # pidfile: /opt/nginx/logs/nginx.pid

    # Source function library.
    . /etc/rc.d/init.d/functions

    # Source networking configuration.
    . /etc/sysconfig/network

    # Check that networking is up.
    [ "$NETWORKING" = "no" ] && exit 0

    nginx="/usr/local/nginx/sbin/nginx"
    prog=$(basename $nginx)

    NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"

    lockfile=/var/lock/subsys/nginx

    start() {
    [ -x $nginx ] || exit 5
    [ -f $NGINX_CONF_FILE ] || exit 6
    echo -n $"Starting $prog: "
    daemon $nginx -c $NGINX_CONF_FILE
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
    }

    stop() {
    echo -n $"Stopping $prog: "
    killproc $prog -QUIT
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
    }

    restart() {
    configtest || return $?
    stop
    start
    }

    reload() {
    configtest || return $?
    echo -n $"?eloading $prog: "?

    RETVAL=$?
    echo
    }

    force_reload() {
    restart
    }

    configtest() {
    $nginx -t -c $NGINX_CONF_FILE
    }

    rh_status() {
    status $prog
    }

    rh_status_q() {
    rh_status >/dev/null 2>&1
    }

    case "$1" in
    start)
    rh_status_q && exit 0
    $1
    ;;
    stop)
    rh_status_q || exit 0
    $1
    ;;
    restart|configtest)
    $1
    ;;
    reload)
    rh_status_q || exit 7
    $1
    ;;
    force-reload)
    force_reload
    ;;
    status)
    rh_status
    ;;
    condrestart|try-restart)
    rh_status_q || exit 0
    ;;
    *)
    echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
    exit 2
    esac

    Some Commands


    /etc/init.d/nginx start

    /etc/init.d/nginx stop

    /etc/init.d/nginx restart

    /etc/init.d/nginx status

    /etc/init.d/nginx status

    نقلا عن : http://stop4host.com/7/how-to-instal...as-proxy-mode/

    من يواجه مشكلة في التنصيب يمكنه الرد بالموضوع وسأتابع معه باذن الرحمن ,

    تحياتي كارم ابراهيم البستاني





    __________________
    GNU/Linux system EngineerVps & Dedicated servers & ManagementContact Me On : 00201003338749 or ceo@murabba.comwww.murabba.com


  2. #2


    للتحديث فقط هل من مشاكل واجهت أي من حاول التركيب ؟
    تحياتي الخالصة للجميع
    كارم ابراهيم البستاني





    __________________
    GNU/Linux system EngineerVps & Dedicated servers & ManagementContact Me On : 00201003338749 or ceo@murabba.comwww.murabba.com

  3. #3
    عضو سوبر نشيط
    تاريخ التسجيل
    Nov 2005
    المشاركات
    779


    شكرا لك اخي كارم .... nginx مسرع للسيرفر
    للعلم من ناحيتي افضل nginxcp فهو الاسهل فالتركيب و التعديل
    وليس هناك فروقات كبيره للعلم

    هنا رابط الnginxcp
    www.nginxcp.com



    نسيت اكتب ملاحظة ,,, في حالة الاخطاء في Cpanel و الاباتشي بالتحديد و قمت بطلب الدعم الفني من فريق cpanel
    فالاغلب انهم سيعتذرون بسبب انهم لا يدعمون mod_rpaf





    التعديل الأخير تم بواسطة عبقري العرب ; 29-10-2011 الساعة 04:47 AM
    __________________
    أهلا و سهلا بكم في :-
    موقع دار الأوائل
    تفضل معنا خدمات الاستضافة
    موقع العبقري لخدمات الاستضافة

  4. #4


    نورت الموضوع أخي عبقري لأحب أن أعتمد شيء جاهز عن نفسي فلذلك لم أفضل الnginxcp

    وضحت الشرح كامل لمن يريد التركيب ومعرفة كل خطوة بنفسه فمن وجهة نظري المتواضعة التركيب ومعرفة الخطوات فائدة في حد ذاتها كما أن لكل شخص اعداداته وأموره الي تخص سرفره ليست كل السرفرات نفس الفكرة او نفس الضغط أو الأمكانيات بالتوفيق للجميع





    __________________
    GNU/Linux system EngineerVps & Dedicated servers & ManagementContact Me On : 00201003338749 or ceo@murabba.comwww.murabba.com

  5. #5
    عضو فعال
    تاريخ التسجيل
    Jun 2003
    المشاركات
    1,077


    اشكرك اخي كارم

    هل ممكن تتكرم علي بتركيب السكربت من فضلك

    اثق بك واحبك في الله فقد ساعدتني كثيرا واثق جدا بعملك وأمانتك

    شكرا لك بجميع الاحوال حتى لو اعتذرت عن التركيب






  6. #6


    مرحبا أخي الكريم جزاك الله خيرا يالغالي هذا من زوقك وكرم أخلاقك

    لا مشكلة بالطبع راسلني برسالة خاصة علي البريد ببيانات سرفرك وسأقوم بتركيبه في أسرع وقت ان شاء الرحمن بالتوفيق ..





    __________________
    GNU/Linux system EngineerVps & Dedicated servers & ManagementContact Me On : 00201003338749 or ceo@murabba.comwww.murabba.com





ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • لا تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •  

أضف موقعك هنا| اخبار السيارات | حراج | شقق للايجار في الكويت | بيوت للبيع في الكويت | دليل الكويت العقاري | مقروء | شركة كشف تسربات المياه | شركة عزل اسطح بالرياض | عزل فوم بالرياض| عزل اسطح بالرياض | كشف تسربات المياة بالرياض | شركة عزل اسطح بالرياض