網路上找到的方法如下:
Change php5-fpm config to use TCP connection instead of socket.
sudo sed -i "s/listen =.*/listen = 127.0.0.1:9000/" /etc/php5/fpm/pool.d/www.conf
Open and edit the default HTTP virtual host.
nano /etc/apache2/sites-enabled/000-default.conf
Add these lines to the default HTTP virtual host config file, this assumes you have your DocumentRoot set to /var/www/html, in an existing setup this could be different and would need to be modified.
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
# for a https server
Protocols h2 http/1.1
Restart services for changes to Apache 2.4.18 and PHP 5.5.32 to take effect.
service apache2 restart
service php5-fpm restart
(optional) Install and configure PageSpeed Module.
cd /tmp
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb
dpkg -i mod-pagespeed-*.deb
nano /etc/apache2/mods-enabled/pagespeed.conf
service apache2 restart
(optional) Install other PHP extensions and software packages.
# redis
apt-get install -y redis-server php5-redis
# memcached
apt-get install -y php5-memcached memcached
# restart php
service php5-fpm restart
- sudo -i
- apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
- reboot
- sudo -i
- apt-get install python-software-properties
- add-apt-repository -y ppa:ondrej/apache2
- add-apt-repository -y ppa:ondrej/php5
- apt-key update
- apt-get update && apt-get upgrade -y
- apt-get install -y php5-fpm apache2
- a2enmod proxy_fcgi proxy proxy_http http2 ssl expires headers rewrite
Change php5-fpm config to use TCP connection instead of socket.
sudo sed -i "s/listen =.*/listen = 127.0.0.1:9000/" /etc/php5/fpm/pool.d/www.conf
Open and edit the default HTTP virtual host.
nano /etc/apache2/sites-enabled/000-default.conf
Add these lines to the default HTTP virtual host config file, this assumes you have your DocumentRoot set to /var/www/html, in an existing setup this could be different and would need to be modified.
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
# for a https server
Protocols h2 http/1.1
Restart services for changes to Apache 2.4.18 and PHP 5.5.32 to take effect.
service apache2 restart
service php5-fpm restart
(optional) Install and configure PageSpeed Module.
cd /tmp
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb
dpkg -i mod-pagespeed-*.deb
nano /etc/apache2/mods-enabled/pagespeed.conf
service apache2 restart
(optional) Install other PHP extensions and software packages.
# redis
apt-get install -y redis-server php5-redis
# memcached
apt-get install -y php5-memcached memcached
# restart php
service php5-fpm restart
留言
張貼留言