2021年1月3日星期日

Apache mod_fcgid - fcgid.conf 设置

#Add php-wrapper

$ vi /var/www/cgi-bin/php-wrapper

#!/bin/sh
PHPRC="/var/www/cgi-bin/php.ini"
export PHPRC
PHP_FCGI_CHILDREN=4

PHP_FCGI_MAX_REQUESTS=10000
export PHP_FCGI_MAX_REQUESTS

export PHP_FCGI_CHILDREN
exec /usr/bin/php-cgi 


#Update fcgid.conf

$ vi /etc/httpd/conf.d/fcgid.conf

#Insert to fcgid.conf
FcgidFixPathinfo 1
FcgidIdleTimeout 3600
FcgidProcessLifetime 7200
FcgidMaxProcesses 64
FcgidMaxProcessesPerClass 8
FcgidConnectTimeout 300
FcgidIOTimeout 7200
FcgidBusyTimeout  600
FcgidMaxRequestLen 51200000
#add in the end
FcgidWrapper /var/www/cgi-bin/php-wrapper .php
AddHandler fcgid-script .php
Action fcgid-fastcgi /cgi-bin/php-wrapper
AddType application/x-httpd-php .php
DirectoryIndex index.php

<Location /cgi-bin/php-wrapper>
   Options All
   AllowOverride All
   Require all denied
</Location>

<IfModule mod_fcgid.c>
    #SuexecUserGroup apache apache
    <Directory /var/www/html>
      Options All
      AllowOverride All
      Require all granted
      AddHandler fcgid-script .php
      FcgidWrapper /var/www/cgi-bin/php-wrapper .php
    </Directory>
</IfModule> 

#!bin/sh
chmod 755 /var/www/cgi-bin/php-wrapper
cp /etc/php.ini /var/www/cgi-bin/php.ini
service httpd restart
#systemctl restart httpd.service

#Security Settings
vi /var/www/cgi-bin/php.ini
...
disable_functions =exec,passthru,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,error_log,ini_alter,ini_restore,dl,pfsockopen,syslog,readlink,symlink,popen,stream_socket_server,putenv
...



没有评论:

发表评论

Apache mod_fcgid - fcgid.conf 设置

#Add php-wrapper $ vi /var/www/cgi-bin/php-wrapper #!/bin/sh PHPRC="/var/www/cgi-bin/php.ini" export PHPRC PHP_FCGI_CHILDREN=4 PHP...