The OpenNET Project / Index page

[ ������� /+++ | ����� | ���� | ]

��������� ������ Plesk 8 ����� PHP/FastCGI(mod_fcgid) + SuExec (plesk python web fastcgi php apache)


<< ���������� ������ ��������� src / ������ ��������� >>
�������� �����: plesk, python, web, fastcgi, php, apache,  (����� ������� ���������)
From: Alexander Dryantsov <lucif3r@mail.ru.> Newsgroups: email Date: Mon, 23 May 2008 17:02:14 +0000 (UTC) Subject: ��������� ������ Plesk 8 ����� PHP/FastCGI(mod_fcgid) + SuExec ����������
  • ��������
  • ��������� Apache
  • ��������� Apache
  • ��������� � ��������� PHP
  • �������� ���������� �� ������
  • ������ ��� ������������� ��������� �������� ������ �������� ��������� ��������� ������� ��� ����������� ����������� ������ Plesk ��� ������ � Apache 2.2.3 � mod_fcgid � PHP 5.2.6 � ������ FastCGI + Suhosin Security patch + ������ eAccelerator + ������ ZendOptimizer + ������ ionCube loader ����� ���������� �������� ���������� /root/distr, � ��� �� ����� ���������� ��� ���� ���������: mkdir /root/distr ��������� Apache � ������ mod_fcgid ���������� �������� IPC_COMM_TIMEOUT, ���������� �� ����� �������� ������� �� �������(PHP). �� ������� ���� ������� ��������� � 40 ������, � ���������� ��������� ���� �������, � ��� ������, ���� � ��� ������� ��������� �������. � ��������� � Apache 2 ������ �������� �������� ���� ��������� ��� ����������� ������, ������� ���������� �������� �������� � ���������,� ����� fcgid_conf.c. cd /root/distr/ wget http://ovh.dl.sourceforge.net/sourceforge/mod-fcgid/mod_fcgid.2.2.tgz tar -zxf mod_fcgid.2.2.tgz cd mod_fcgid.2.2 perl -i.bak -pe "s/\/usr\/local\/apache2/\/usr\/lib\/httpd/" Makefile perl -i.bak-default -pe "s/DEFAULT_IPC_COMM_TIMEOUT 40/DEFAULT_IPC_COMM_TIMEOUT 300/" /root/distr/mod_fcgid.2.2/fcgid_conf.c make cp /etc/httpd/modules/mod_fcgid.so /root/distr/mod_fcgid.so.default make install ��������� Apache ����������, ��� /etc/httpd/conf.d/fcgid.conf �������� ��������� �������: # added by psa-mod-fcgid-configurator LoadModule fcgid_module /usr/lib/httpd/modules/mod_fcgid.so <IfModule mod_fcgid.c> SocketPath /var/lib/httpd/fcgid/sock </IfModule> # added by psa-mod-fcgid-configurator <IfModule mod_fcgid.c> MaxRequestsPerProcess 500 PHP_Fix_Pathinfo_Enable 1 IdleTimeout 3600 ProcessLifeTime 7200 BusyTimeout 1400 OutputBufferSize 4k DefaultInitEnv RAILS_ENV production IPCCommTimeout 600 DefaultMaxClassProcessCount 2 DefaultMinClassProcessCount 1 </IfModule> ���. ��������� Apache'� ���������. ��������� � ��������� PHP ��������� � ��������� PHP � PHP, ��������� � ������ FastCGI ���������� �������� - ������� ����� ���� ������� � �� ����, �.�. ��������� ���������� ������ � �� �������� �� ������ SIGTERM, � �������������� ������� fastcgi ��� ������� �������. ��� ���� ����� ������ ��� �������� �� ������ ��������� � PHP ������������ �� �������������� ���������� ��������, � ��� ������, ���� �� �� ��� ���� �������� TERM. ���� php-kill.patch:
  • sapi/cgi/cgi_main.c.orig 2008-04-30 02:32:18.000000000 -0500 --- sapi/cgi/cgi_main.c 2008-04-30 08:36:18.000000000 -0500 ***************
  • 1150,1155 **** --- 1150,1164 ---- /* Kill all the processes in our process group */ kill(-pgroup, SIGTERM); + if (signal == SIGINT) { + sigaction(SIGINT, &old_int, 0); + kill(-pgroup, SIGINT); + } else { + sigaction(SIGTERM, &old_term, 0); + kill(-pgroup, SIGTERM); + } + sigaction(SIGKILL, &old_term, 0); + kill(-pgroup, SIGKILL); #endif /* We should exit at this point, but MacOSX doesn't seem to */ ��������� ����: patch -p0 < php-kill.patch ������������� PHP(������ ��������� ���� ������� � ����� ��������, ���� ������ ������� ����) ��������: � �������� ���������� �� ������ ��������� ������ Apache'� ��� ������ ������, ������� ����� ���� ������������ � Apache'�, ����� ����, ��� �������������, �� ������� ����������� PHP ������� �� ���. ���������: cd /root/distr wget "http://download.suhosin.org/suhosin-patch-5.2.6-0.9.6.2.patch.gz" gunzip suhosin-patch-5.2.6-0.9.6.2.patch.gz wget http://ru2.php.net/get/php-5.2.6.tar.gz/from/this/mirror tar -zxf php-5.2.6.tar.gz cd php-5.2.6 patch -p1 < ../suhosin-patch-5.2.6-0.9.6.2.patch './configure' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' \ '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' \ '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' \ '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' \ '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-pic' '--with-mcrypt' \ '--with-mhash' '--with-bz2' '--with-curl' '--with-freetype-dir=/usr' '--with-png-dir=/usr' \ '--enable-gd-native-ttf' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' \ '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' \ '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' \ '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' \ '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' \ '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' \ '--with-mime-magic=/etc/httpd/conf/magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' \ '--with-mysql' '--with-gd' '--with-odbc' '--enable-dom' '--enable-dba' '--enable-pdo' '--enable-xmlreader' \ '--enable-xmlwriter' '--enable-suhosin' '--with-imap' '--with-imap-ssl' '--enable-fastcgi' '--enable-force-cgi-redirect' make make install mkdir /php-fastcgi /etc/rc.d/init.d/httpd stop cp /usr/bin/php-cgi /root/distr/ cp /php-fastcgi/php-cgi /root cp /usr/bin/php-cgi /php-fastcgi/ /etc/rc.d/init.d/httpd start cd /root/distr wget http://bart.eaccelerator.net/source/0.9.5.2/eaccelerator-0.9.5.2.tar.bz2 tar -jxf eaccelerator-0.9.5.2.tar.bz2 cd eaccelerator-0.9.5.2 make clean phpize ./configure --enable-eaccelerator=shared --with-php-config=/usr/bin/php-config make extension_dir=`cat /etc/php.ini|grep extension_dir|grep -v "^;"|awk '{print $3}'|perl -pe "s/\"//g"` cp -rf `make install|grep "Installing shared extensions:"|awk '{print $4}'`eaccelerator.so $extension_dir/ /etc/rc.d/init.d/httpd stop cd /root/distr/php-5.2.6 make distclean './configure' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' \ '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' \ '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' \ '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' \ '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-pic' '--with-mcrypt' \ '--with-mhash' '--with-bz2' '--with-curl' '--with-freetype-dir=/usr' '--with-png-dir=/usr' \ '--enable-gd-native-ttf' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' \ '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' \ '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' \ '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' \ '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' \ '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' \ '--with-mime-magic=/etc/httpd/conf/magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' \ '--with-mysql' '--with-gd' '--with-odbc' '--enable-dom' '--enable-dba' '--enable-pdo' '--enable-xmlreader' \ '--enable-xmlwriter' '--enable-suhosin' '--with-imap' '--with-imap-ssl' '--enable-fastcgi' '--enable-force-cgi-redirect' make clean make make install cd /root/distr echo "zend_extension=/usr/lib/php/ioncube/ioncube_loader_lin_5.2.so" >> /etc/php.ini echo -en "extension=\"eaccelerator.so\"\neaccelerator.shm_size=\"16\"\neaccelerator.cache_dir=\"/tmp/eaccelerator\"\n eaccelerator.enable=\"1\"\neaccelerator.optimizer=\"1\"\neaccelerator.check_mtime=\"1\"\neaccelerator.debug=\"0\"\n eaccelerator.filter=\"\"\neaccelerator.shm_max=\"0\"\neaccelerator.shm_ttl=\"0\"\neaccelerator.shm_prune_period=\"0\"\n eaccelerator.shm_only=\"0\"\neaccelerator.compress=\"1\"\neaccelerator.compress_level=\"9\"\n" >>/etc/php.ini mkdir /tmp/eaccelerator chmod 0777 /tmp/eaccelerator echo "zend_extension=/usr/lib/php/zend/ZendOptimizer-5.2.so" >> /etc/php.ini echo "zend_optimizer.optimization_level=0" >> /etc/php.ini cd /root/distr/eaccelerator-0.9.5.2 wget http://perun.x-shops.com/php.ini cp /root/distr/php.ini /etc/php.ini rm -f /root/distr/php.ini ����� ���� ���������� ��������� ��������� �� ioncube � php.ini, ���� ���, �� �������� �������: zend_extension=/usr/lib/php/ioncube/ioncube_loader_lin_5.2.so �������� ���������� �� ������ � �������� ������������ Plesk'� ��������� ������ ������������� ���������� ������ �������������, ��� �� ����� �������, ������� �� ����������� ������� ������ ��� ������������� ������ �������. �.�. ��� ��� ��������� � ������ psacln, �� �������� �������� ���� ������: chgrp apache /etc/httpd/conf chgrp apache /etc/httpd/conf.d chmod -R 750 /etc/httpd/conf chmod -R 750 /etc/httpd/conf.d chgrp apache /var/www/vhosts chmod 751 /var/www/vhosts chgrp nobody /var/lib/php/session chgrp psacln /etc/group chmod 604 /etc/group chgrp psacln /etc/passwd chmod 604 /etc/passwd chgrp psacln /etc/passwd- chmod 604 /etc/passwd- chgrp psacln /usr/bin/who chmod 705 /usr/bin/who chgrp psacln /bin/ps chmod 705 /bin/ps chgrp psacln /etc/ftpusers chmod 705 /etc/ftpusers chown root:root /root chmod 750 /root chgrp psacln / chmod 715 / chgrp psacln /bin chmod 751 /bin chgrp psacln /etc chmod 715 /etc chgrp psacln /dev chmod 715 /dev chgrp psacln /home chmod 705 /home chgrp psacln /lib chmod 715 /lib chgrp psacln /media chmod 705 /media chgrp psacln /misc chmod 705 /misc chgrp psacln /mnt chmod 705 /mnt chgrp psacln /net chmod 705 /net chgrp psacln /opt chmod 705 /opt chgrp psacln /proc chmod 705 /proc chgrp psacln /sbin chmod 715 /sbin chgrp psacln /usr chmod 715 /usr chgrp psacln /selinux chmod 705 /selinux chgrp psacln /srv chmod 705 /srv chgrp psacln /var chmod 715 /var chgrp psacln /tmp chmod 733 /tmp ������ ��� ������������� ��������� ������������� ������ ������� ��� ��������������� ���������� "�����������" � ������������ Apache'� � MPM peruser... ����... � ����������� ������ ��� ���������. ������ �������� ��� ����������� ����� �� ������� � ��������� ������� �� ��� PHP � �������. ������ ������ ���������� �������� � Action'� Plesk'� �� �������� Physical hosting'� � ���������� alias'��, ���� � /etc/rc.d/init.d/httpd ��� ������� � reload/condrestart: #!/bin/sh # Author: Alexander Dryantsov #### ### # Prepare ### function cecho (){ export black='\E[0m\c' export boldblack='\E[1;0m\c' export red='\E[31m\c' export boldred='\E[1;31m\c' export green='\E[32m\c' export boldgreen='\E[1;32m\c' export yellow='\E[33m\c' export boldyellow='\E[1;33m\c' export blue='\E[34m\c' export boldblue='\E[1;34m\c' export magenta='\E[35m\c' export boldmagenta='\E[1;35m\c' export cyan='\E[36m\c' export boldcyan='\E[1;36m\c' export white='\E[37m\c' export boldwhite='\E[1;37m\c' local default_msg="" # Doesn't really need to be a local variable. message=${1:-$default_msg} # Defaults to default message. color=${2:-$black} # Defaults to black, if not specified. echo -en "$color" echo -en "$message" tput sgr0 # Reset to normal. echo -en "$black" return } current_date=`date "+%H:%M %d.%m.%Y"` mysql_password=`cat /etc/psa/.psa.shadow` ################# # Implementation ################# cecho "" $white cecho "Fixing Horde...\n" $boldgreen # ���� � ���� c����� perl -i.bak -pe "s/php_admin_value open_basedir/#php_admin_value open_basedir/g;s/php_admin_value include_path/#php_admin_value include_path/g" /etc/httpd/conf.d/zz010_psa_httpd.conf mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Bse \ "select login,home from sys_users;" psa| while read user path; do cecho "\tUser: " $boldyellow echo -en "$user\n"; users_domain=`echo $path | perl -pe 's/.*\///g'` cecho "\tDomain: " $yellow echo $users_domain chown $user:psacln $path chmod 705 $path if [ -f $path/conf/vhost.conf ]; then cecho " Domain already configured\n" $boldgreen fi if [ -f $path/conf/httpd.include ]; then perl -i.bak -pe "s/.*open_basedir.*//g" $path/conf/httpd.include if [ "`cat $path/conf/httpd.include|grep FCGIWrapper|awk '{print $1}'|uniq`" == "FCGIWrapper" ]; then echo -en ""; else echo "Adding PHP-FCGI support to httpd.include" perl -i.bak -pe "s|AddHandler fcgid| AddHandler fcgid-script .php FCGIWrapper $path/php-fastcgi/php5-cgi .php AddHandler fcgid|g" $path/conf/httpd.include fi; chownusergroup=`cat $path/conf/httpd.include|grep Suexec|awk '{print $2":"$3}'|uniq` if [ -z $path/php-fastcgi ]; then echo -en ""; chmod 755 $path/php-fastcgi/php5-cgi else mkdir $path/php-fastcgi 2> /dev/null if [ -f $path/php-fastcgi/php5-cgi ]; then echo -en "" chmod 755 $path/php-fastcgi/php5-cgi else echo "#!/bin/sh PHPRC=\"/etc\" export PHPRC PHP_FCGI_CHILDREN=8 export PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=5000 export PHP_FCGI_MAX_REQUESTS exec /php-fastcgi/php-cgi " > $path/php-fastcgi/php5-cgi chmod 755 $path/php-fastcgi/php5-cgi chown -R $chownusergroup $path/php-fastcgi fi; fi; chown $chownusergroup $path/cgi-bin chown $chownusergroup $path/httpsdocs fi echo -en "\n\n" done ������� ������� ����� �����, ����� ������ ��������� � ��� ������������� PHP FastCGI.

  • << ���������� ������ ��������� src / ������ ��������� >>

    ���������� [ RSS ]
  • 1, Ilya 8211 Toyo (?), 00:27, 11/08/2008 [��������]  
  • +/
    ������, �� �� ������� �������� ���� �� �����, � ����� ����� �� ������� ������ ��� ��������� ������� �����.

    p.s. plesk vhost.conf � vhost_ssl.conf in google.

     
  • 2, TiM (??), 16:27, 12/11/2008 [��������]  
  • +/
    � ������ � vhost/vhost_ssl ���-�� ������������ ������ ������� � 3 ���� ������. �������� ���� �������� ����� � ������ ��������� �������.

    �� ��� �� ���� ���-�� ����� ������ ������������ ���� httpd.include ��� plesk-a � ���� ������� ������ - ������� �������� ��������, �� �� �������� ��� ������������ ������ (��� ������������ ���� ��������� � ������� ������), �.�. ������� ��֣���.

     
     
  • 3, Ilya 8211 Toyo (?), 10:06, 13/11/2008 [^] [^^] [^^^] [��������]  
  • +/
    >� ������ � vhost/vhost_ssl ���-�� ������������ ������ ������� � 3 ���� ������.
    >�������� ���� �������� ����� � ������ ��������� �������.
    >
    >�� ��� �� ���� ���-�� ����� ������ ������������ ���� httpd.include ��� plesk-a
    >� ���� ������� ������ - ������� �������� ��������, �� �� ��������
    >��� ������������ ������ (��� ������������ ���� ��������� � ������� ������), �.�.
    >������� ��֣���.

    ������� ������������ ������ ���� ��� ��� ������ �������, ���� ����� ���� �������� ������, ��� ������ �� �������.

     

     ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ �����������
    ���:
    E-Mail:
    ���������:
    �����:




    ������:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    �������:

    �������� �� �����
    ���������� �� ���������
    Created 1996-2026 by Maxim Chirkov
    ��������, ����������, ����������