WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Apache 2.4 with Event MPM sample configuration (6 posts)

  1. creyes123
    Member
    Posted 9 months ago #

    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>
  2. Haoxian
    Member
    Posted 4 months ago #

    Hi, creyes,

    Cheers.

    May I ask what is the purpose the ProxyPassMatch line?

  3. creyes123
    Member
    Posted 4 months ago #

    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>
  4. creyes123
    Member
    Posted 4 months ago #

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

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

  5. Haoxian
    Member
    Posted 4 months ago #

    Hi, creyes123,

    Thanks.

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

  6. creyes123
    Member
    Posted 4 months ago #

    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.

Reply

You must log in to post.

About this Topic