• Resolved creyes123

    (@creyes123)


    Apache 2.4 includes some neat new functionality that be used to run PHP websites like WordPress very efficiently. A generic configuration can be found on http://wiki.apache.org/httpd/PHP-FPM. But that is not quite enough to have a WordPress website running well. After some tinkering, I came up with the following:

    <VirtualHost _default_:80>
      ServerName            domain.com
      ServerAlias           www.domain.com
    
      DocumentRoot          /srv/http/domain
      CustomLog             /var/log/apache2/domain_access.log common
      ErrorLog              /var/log/apache2/domain_error.log
    
      <Directory />
        FallbackResource    index.php
        DirectoryIndex      index.php
        Options             Indexes FollowSymLinks
        AllowOverride       None
        Require             all granted
      </Directory>
    
      ProxyPassMatch        ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/http/domain/$1
    </VirtualHost>
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi, creyes,

    Cheers.

    May I ask what is the purpose the ProxyPassMatch line?

    Thread Starter creyes123

    (@creyes123)

    Hi. I have not had to look at my configuration for a long time, so give me a day or so to come up with a good answer to your question. In the meantime, here is the final configuration I came up with. It has been working fine for a long time:

    <VirtualHost _default_:80>
      ServerName            www.domain.com
      Redirect              permanent / http://domain.com/
    </VirtualHost>
    
    <VirtualHost _default_:80>
      ServerName            domain.com
    
      DocumentRoot          /srv/http/domain
      CustomLog             /var/log/apache2/domain_access.log common
      ErrorLog              /var/log/apache2/domain_error.log
    
      <Directory />
        FallbackResource    /index.php
        DirectoryIndex      index.php
        Options             Indexes FollowSymLinks
        AllowOverride       All
        Require             all granted
      </Directory>
    
      <Directory /wp-admin>
        FallbackResource    /wp-admin/index.php
      </Directory>
    
      ProxyPassMatch        ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/http/domain/$1
    </VirtualHost>
    Thread Starter creyes123

    (@creyes123)

    Here is a link to the Apache documentation on that directive:

    http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassmatch

    Hi, creyes123,

    Thanks.

    I think I find it out. The ProxyPassMatch line serves the fastcgi programme, or something like that.

    Thread Starter creyes123

    (@creyes123)

    Yes, that’s it in a nutshell. It does a regular expression match on the file to make sure it is a PHP file. Then it passes it as an argument to the Fast CGI handler on port 9000.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Apache 2.4 with Event MPM sample configuration’ is closed to new replies.