Configuring an Apache/PHP Application Server
4 stars based on
A bare bones Apache server is suitable for delivering static files. More complex applications rely on dynamic content. This requires an extension of the server. This is by far not the only option and also likely not the most widespread one in a corporate environment. But is a very simple architecture perfectly suited for a test system. I will no longer be discussing the overall configuration, but will instead only be focusing on the differences from Tutorial 2.
There are three new modules: It is assigned using the AddHandler directive. This is the connection between the web server and the FCGI daemon yet to be configured. Once the first request using the. FastCGI is a method for executing dynamic program code from a web server. It is a very fast method which for the apr 1 config binary trading part leaves the server untouched and runs the application on a separate daemon.
To increase the apr 1 config binary trading, FastCGI provides multiple instances of this daemon, allowing requests to be processed without having to wait. In practice, this is a promising gain in performance and, more importantly, an architecture that saves memory, as will be discussed in more detail below.
We now have to compile two missing modules and deploy other components for the FCGI daemon. An Apache web server was compiled in Tutorial 1. The web server configured in Tutorial 2 runs as user www-data or, depending on configuration, as any other dedicated user. We would like to further restrict apr 1 config binary trading dynamic application to have the separate daemon run as an additional, separate user that is apr 1 config binary trading in one of the next steps.
The suEXEC module makes this possible for us. It is not absolutely required. But it adds a bit more security with little extra effort. Besides configurewhich we are familiar with, three options have been added for handling suexec. Enable-suexec is self-explanatory, with-suexec-caller we tell the conscientious module that only the user www-data is to be given permission to access the program behind the apr 1 config binary trading. We are after all telling the module where scripts being called are located.
So it will have to be the fully qualified path. If successfully configured, apr 1 config binary trading command line above will start the compiler and after being successfully concluded will install the newly compiled server. The new options will otherwise be ignored.
But it is not part of the normal source code for the web server. We again expect an OK. The configure command has a slightly different format here, because the FCGI module is a module dependent on Apache. Unfortunately, make install will partly destroy some of the ownerships we have set. They will have to be adjusted afterwards.
The Apache user also needs access to a directory for him to create sockets, enabling communication with the FCGI daemon. Up till now we have been compiling all of the software piece by piece. But for the entire PHP stack a limit has been reached. No one should be prevented from compiling PHP on his own, but we are concentrating on the web server here and for apr 1 config binary trading reason will be using this piece of software from the Linux distribution.
Properly configuring PHP is a broad topic and I recommend consulting the relevant pages, because an improperly configured installation of PHP may pose a serious security problem. For operation on the internet, i. Above it has already been discussed that we are planning to start a separate daemon to process PHP requests. This daemon should be started via suexec and run as separate user.
We create the user as follows:. We can ignore it. We already set this up in the Apache configuration above. The web server will invoke only the script, while the script takes care of everything else. We now have to put a starter script in this directory. Since we have already assigned fcgi-php to the user, the root user apr 1 config binary trading have to create the script.
Or be copied by him to this location. Creating a script in apr 1 config binary trading directory that we no longer own is challenging. What are we defining here? We are telling PHP where to find its configuration, setting the maximum number of requests for an FCGI to 5, after which it is replaced by a fresh processdefining the number of process children to 5 and executing PHP at the end. To finish things off, we should now create a simple PHP-based test page: Our test script is available at http: Errors are typically related to ownership of and permission to access directories and files.
Compared to Apache with integrated PHPthe application server built here is very high performance. A little performance test can illustrate this. We start our web server in daemon mode and use ApacheBench apr 1 config binary trading put it to the test it with 5 users. The -l option is new. It instructs the tool to ignore deviations in the length of the responses. This is because the page is generated dynamically and the content, as well as its length, will of course be a bit different now and then.
We again quit the server following the performance test. Which is a lot. Especially considering that the result is from a small test computer. On a modern production-size server performance many times this can be achieved. In an integrated setup we would have to use the Prefork MPMwhich works with memory-intensive server processes and not server threads.