Ubuntu Apache 支持php-fpm

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# 
    
发布了57 篇原创文章 · 获赞 21 · 访问量 6776
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览