1.开启Apache的Status页面:
vi /usr/local/directadmin/custombuild/configure/ap2/conf/extra/httpd-info.conf #在文件末端插入以下内容 #APACHE-STATUS <Location /apache-status> SetHandler server-status Require ip 192.168.1 127 </Location> #APACHE-INFO <Location /apache-info> SetHandler server-info Require ip 192.168.1 127 </Location>
2.开启php-fpm的status页面和慢日志
cp /usr/local/directadmin/data/templates/php-fpm.conf /usr/local/directadmin/data/templates/custom/php-fpm.conf vi /usr/local/directadmin/data/templates/custom/php-fpm.conf #在文件末端插入以下内容 pm.status_path = /fpm-status ping.path = /fpm-ping slowlog = /usr/local/php|PHP_VER|/var/log/slowlog-|USER|.log request_slowlog_timeout = 15s
cp /usr/local/directadmin/data/templates/virtual_host2.conf /usr/local/directadmin/data/templates/custom/virtual_host2.conf vi /usr/local/directadmin/data/templates/custom/virtual_host2.conf #找到<VirtualHost |IP|:|PORT_80| |MULTI_IP|>下一行插入以下内容 |*if HAVE_PHP1_FPM="1"| #FPM-STATUS <FilesMatch "^fpm-status|fpm-ping$"> RewriteEngine Off SetHandler "proxy:unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock|fcgi://localhost" Require ip 192.168.1 127 </FilesMatch> |*endif| |*if HAVE_PHP2_FPM="1"| #FPM-STATUS <FilesMatch "^fpm-status|fpm-ping$"> RewriteEngine Off SetHandler "proxy:unix:/usr/local/php|PHP2_RELEASE|/sockets/|USER|.sock|fcgi://localhost" Require ip 192.168.1 127 </FilesMatch> |*endif|
cp /usr/local/directadmin/data/templates/virtual_host2_secure.conf /usr/local/directadmin/data/templates/custom/virtual_host2_secure.conf vi /usr/local/directadmin/data/templates/custom/virtual_host2_secure.conf #找到<VirtualHost |IP|:|PORT_443| |MULTI_IP|>下一行插入以下内容 |*if HAVE_PHP1_FPM="1"| #FPM-STATUS <FilesMatch "^fpm-status|fpm-ping$"> RewriteEngine Off SetHandler "proxy:unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock|fcgi://localhost" Require ip 192.168.1 127 </FilesMatch> |*endif| |*if HAVE_PHP2_FPM="1"| #FPM-STATUS <FilesMatch "^fpm-status|fpm-ping$"> RewriteEngine Off SetHandler "proxy:unix:/usr/local/php|PHP2_RELEASE|/sockets/|USER|.sock|fcgi://localhost" Require ip 192.168.1 127 </FilesMatch> |*endif|
以上内容自行修改Require ip部分允许访问IP
最后重新生成所有配置文件
cd /usr/local/directadmin/custombuild ./build rewrite_confs