Spis treści

Apache

Proste konfiguracje

Sprawdzenie konfiguracji

/etc/init.d/httpd configtest

lub

apache2ctl configtest

Vhost SSL

<VirtualHost *:443>

...

SSLEngine on
SSLCertificateFile /etc/ssl/server.crt
SSLCertificateKeyFile /etc/ssl/server.key
SSLCACertificateFile /etc/ssl/ca.crt

...

</VirtualHost>

PHP via FCGID + SuEXEC

Konfiguracja Apache

<VirtualHost *:80>

        SuexecUserGroup kamil users

        ErrorLog /home/services/httpd/users/kamil/test.com.pl/error.log
        TransferLog /home//services/httpd/users/kamil/test.com.pl/access.log

        <Directory /home/services/httpd/users/kamil/test.com.pl/htdocs>
                Options ExecCGI Indexes Includes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                Allow from all
                AddHandler fcgid-script .php
                FCGIWrapper /home/services/httpd/users/kamil/test.com.pl/fcgid/php.fcgi .php
        </Directory>

        ServerAdmin kamil@test.com.pl
        DocumentRoot /home/services/httpd/users/kamil/test.com.pl/htdocs

        ServerName test.com.pl

</VirtualHost>

Struktura katalogów

chown -R kamil:http /home/services/httpd/users/kamil
chmod -R 710 /home/services/httpd/users/kamil
chown kamil:http /home/services/httpd/users/kamil/test.com.pl/{htdocs,tmp}
chmod -R 750 /home/services/httpd/users/kamil/test.com.pl/{htdocs,tmp}
chown kamil:users /home/services/httpd/users/kamil/test.com.pl/fcgid
chmod -R 711 /home/services/httpd/users/kamil/test.com.pl/fcgid

Plik /home/services/httpd/users/kamil/test.com.pl/fcgid/php.fcgi:

#!/bin/sh

export PHP_FCGI_CHILDREN=4
export PHP_FCGI_MAX_REQUESTS=500
exec /usr/bin/php.fcgi $@

Uprawnienia:

chmod 700 /home/services/httpd/users/kamil/test.com.pl/fcgid/php.fcgi
chown kamil:users /home/services/httpd/users/kamil/test.com.pl/fcgid/php.fcgi

Restartujemy Apache i sprawdzamy

/etc/init.d/httpd start
Uruchamianie usługi Apache 2.2 Web Server (prefork)................[ ZROBIONE ]
ps aux | grep httpd
root      2508  0.0  0.7   7988  3936 ?        SNs  15:28   0:00 /usr/sbin/httpd.prefork
http      2512  0.0  0.4   7924  2276 ?        SN   15:28   0:00 /usr/sbin/httpd.prefork
http      2513  0.0  0.4   7988  2252 ?        SN   15:28   0:00 /usr/sbin/httpd.prefork
http      2514  0.0  0.5   8192  2940 ?        SN   15:28   0:00 /usr/sbin/httpd.prefork
http      2515  0.0  0.4   7988  2240 ?        SN   15:28   0:00 /usr/sbin/httpd.prefork
http      2516  0.0  0.5   8120  2756 ?        SN   15:28   0:00 /usr/sbin/httpd.prefork
http      2517  0.0  0.5   8120  2844 ?        SN   15:28   0:00 /usr/sbin/httpd.prefork
http      2518  0.0  0.4   7988  2240 ?        SN   15:28   0:00 /usr/sbin/httpd.prefork
http      2519  0.0  0.4   7988  2240 ?        SN   15:28   0:00 /usr/sbin/httpd.prefork
http      2520  0.0  0.4   7988  2240 ?        SN   15:28   0:00 /usr/sbin/httpd.prefork
root      2568  0.0  0.1   2808   844 pts/0    S+   15:53   0:00 grep httpd
[root@pld_fcgid /]# pstree -up 2508
httpd.prefork(2508)-+-httpd.prefork(2512,http)---php.fcgi(2526,kamil)-+-php.fcgi(2527)
                    |                                                 |-php.fcgi(2528)
                    |                                                 |-php.fcgi(2529)
                    |                                                 `-php.fcgi(2530)
                    |-httpd.prefork(2513,http)
                    |-httpd.prefork(2514,http)
                    |-httpd.prefork(2515,http)
                    |-httpd.prefork(2516,http)
                    |-httpd.prefork(2517,http)
                    |-httpd.prefork(2518,http)
                    |-httpd.prefork(2519,http)
                    `-httpd.prefork(2520,http)