apache + php php-fpm 多站点配置:

时间:2022-10-20 15:39:03

1:/usr/local/apache2/conf/vhosts下增加web2.conf

ps: /usr/loca/apache2/conf/httpd.conf  最下边有:Include /usr/local/apache2/conf/vhosts/*.conf

web2.conf内容:

<virtualHost *:80>
DocumentRoot /opt/www/web2
ServerName jinyunxinxi.com
ServerAlias test2.jinyunxinxi.com
DirectoryIndex index.htm index.html index.shtml index.php
CustomLog "|/usr/local/apache2/bin/rotatelogs -l /usr/local/apache2/logs/web2%Y%m%d.log 10M" common
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:7005/opt/www/web2/$1
<Directory /opt/www/web2>
Options FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</virtualHost>

2:/opt/php-fpm/ 下新建web2文件夹新增php-fpm.conf、php-fpm.pid 两个文件

php-fpm.conf:

[global]
pid = /opt/php-fpm/web2/php-fpm.pid
[www]
user = default
group = ftp
listen = 127.0.0.1:7005
pm = dynamic
pm.max_children = 2
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1
pm.max_requests = 1000
php_admin_value[open_basedir]=/opt/www/web2:/opt/php-fpm/web2/tmp
php_admin_value[session.save_path]=/opt/php-fpm/web2/tmp

php_admin_value[upload_tmp_dir]=/opt/php-fpm/web2/tmp


php-fpm.pid:

1990

重启php-fpm:/usr/local/php5.4/sbin/php-fpm

注:如果提示:apache + php php-fpm 多站点配置:

netstat -lntup | grep 9000

apache + php php-fpm 多站点配置:

killall php-fpm

重启apache:service httpd restart