2016年3月15日 星期二

FreeBSD 10.2 設定 apache24 php

apache24-2.4.18:

一、CONFIGURE

# ee /usr/local/etc/apache24/httpd.conf

(~211)
# ServerAdmin you@example.com
ServerAdmin admin@testbsd.com

(~220)
#ServerName www.example.com:80
ServerName ns1.testbsd.com:80

# ee /etc/rc.conf

apache24_enable="YES"

# /usr/local/etc/rc.d/apache24 restart
Performing sanity check on apache24 configuration:
Syntax OK
apache24 not running? (check /var/run/httpd.pid).
Performing sanity check on apache24 configuration:
Syntax OK
Starting apache24.

已能正常啟動

測試組態是否正常

# apachectl configtest
Performing sanity check on apache24 configuration:
Syntax OK

!!!! 如果沒使用 SSL 就到此。

二、CONFIGURE

# ee /usr/local/etc/apache24/httpd.conf

(~89)
LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so

(~141)
LoadModule ssl_module libexec/apache24/mod_ssl.so

(~511)
Include etc/apache22/extra/httpd-ssl.conf

Save, exit, and open Apache's SSL configuration file:

# ee /usr/local/etc/apache24/extra/httpd-ssl.conf

(~125)
ServerName ns1.testbsd.com:443
ServerAdmin admin@testbsd.com

(144~147)修改路徑
SSLCertificateFile "/usr/local/openssl/SSL/ns1.testbsd.com-cert.pem"

(154~157)
SSLCertificateKeyFile "/usr/local/openssl/SSL/ns1.testbsd.com-unencrypted-key.pem"

Save and exit.

# /usr/local/etc/rc.d/apache24 restart
Performing sanity check on apache24 configuration:
Syntax OK
Stopping apache24.
Waiting for PIDS: 744.
Performing sanity check on apache24 configuration:
Syntax OK
Starting apache24.

測試運行狀況

# openssl s_client -connect localhost:443

------------------------------------------------------

三、PHP CONFIGURE

# ee /usr/local/etc/apache24/httpd.conf

(~278)

<IfModule dir_module>
    DirectoryIndex index.php index.html index.htm
</IfModule>

Scroll down to the bottom of httpd.conf and add these lines:

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>

# /usr/local/etc/rc.d/apache24 restart
Performing sanity check on apache24 configuration:
Syntax OK
Stopping apache24.
Waiting for PIDS: 812.
Performing sanity check on apache24 configuration:
Syntax OK
Starting apache24.

四、PHP TESTING

# ee /usr/local/www/apache24/data/phpinfo.php

and add this line:

<?php phpinfo(); ?>

Save and exit.

http://IP/phpinfo.php
https://IP/phpinfo.php

沒有留言:

張貼留言