Ubuntu Apache 支持php-fpm

16 篇文章 0 订阅
root@youyou:~# apt install apache2 php-fpm
root@youyou:~# cd /etc/apache2/conf-enabled/
root@youyou:/etc/apache2/conf-enabled# ln -sv ../conf-available/php7.2-fpm.conf .
'./php7.2-fpm.conf' -> '../conf-available/php7.2-fpm.conf'
root@youyou:/etc/apache2/conf-enabled# a2enmod proxy_fcgi
Considering dependency proxy for proxy_fcgi:
Enabling module proxy.
Enabling module proxy_fcgi.
To activate the new configuration, you need to run:
  systemctl restart apache2
root@youyou:/etc/apache2/conf-enabled# systemctl restart apache2
root@youyou:/etc/apache2/conf-enabled#

Ubuntu Apache 配置注意事项

  1. php-fpm 需要apache 支持proxy_fcgi模块
  2. apache2 启用模块使用 a2enmod 来启动。
  3. apache2 查看当前工作模式
    root@youyou:/etc/apache2/conf-enabled# a2query -M
    prefork
    root@youyou:/etc/apache2/conf-enabled# 
    
  4. Apache 命令的用法,en是打开,dis是关闭
    管理conf 文件 :
    a2disconf
    a2enconf
    管理mod:
    a2dismod
    a2enmod
    管理站点:
    a2dissite
    a2ensite
    范例,启用关闭proxy_fcgi模块
    root@youyou:/etc/apache2/conf-enabled# a2dismod proxy_fcgi
    root@youyou:/etc/apache2/conf-enabled# a2enmod proxy_fcgi
    
    范例,启用关闭php文件(其实就是做了软连接,把conf-available里的文件链接到enabled)
    root@youyou:/etc/apache2/conf-enabled# a2enconf php7.2-fpm 
    Enabling conf php7.2-fpm.
    To activate the new configuration, you need to run:
      systemctl reload apache2
    root@youyou:/etc/apache2/conf-enabled# ll
    total 8
    drwxr-xr-x 2 root root 4096 Jan 11 08:48 ./
    drwxr-xr-x 8 root root 4096 Jan 11 08:21 ../
    lrwxrwxrwx 1 root root   30 Jan  8 11:52 charset.conf -> ../conf-available/charset.conf
    lrwxrwxrwx 1 root root   44 Jan  8 11:52 localized-error-pages.conf -> ../conf-available/localized-error-pages.conf
    lrwxrwxrwx 1 root root   46 Jan  8 11:52 other-vhosts-access-log.conf -> ../conf-available/other-vhosts-access-log.conf
    lrwxrwxrwx 1 root root   33 Jan 11 08:48 php7.2-fpm.conf -> ../conf-available/php7.2-fpm.conf
    lrwxrwxrwx 1 root root   31 Jan  8 11:52 security.conf -> ../conf-available/security.conf
    lrwxrwxrwx 1 root root   36 Jan  8 11:52 serve-cgi-bin.conf -> ../conf-available/serve-cgi-bin.conf
    root@youyou:/etc/apache2/conf-enabled#
    root@youyou:/etc/apache2/conf-enabled# a2disconf php7.2-fpm 
    Conf php7.2-fpm disabled.
    To activate the new configuration, you need to run:
      systemctl reload apache2
    root@youyou:/etc/apache2/conf-enabled# ll
    total 8
    drwxr-xr-x 2 root root 4096 Jan 11 08:53 ./
    drwxr-xr-x 8 root root 4096 Jan 11 08:21 ../
    lrwxrwxrwx 1 root root   30 Jan  8 11:52 charset.conf -> ../conf-available/charset.conf
    lrwxrwxrwx 1 root root   44 Jan  8 11:52 localized-error-pages.conf -> ../conf-available/localized-error-pages.conf
    lrwxrwxrwx 1 root root   46 Jan  8 11:52 other-vhosts-access-log.conf -> ../conf-available/other-vhosts-access-log.conf
    lrwxrwxrwx 1 root root   31 Jan  8 11:52 security.conf -> ../conf-available/security.conf
    lrwxrwxrwx 1 root root   36 Jan  8 11:52 serve-cgi-bin.conf -> ../conf-available/serve-cgi-bin.conf
    root@youyou:/etc/apache2/conf-enabled# 
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值