Basic

FreeNAS
       
http

設定檔位置:/etc/httpd/conf/httpd.conf
網頁資料位置:/var/www/html
網頁執行檔位置:/var/www/cgi-bin
網頁相關紀錄檔目錄:/var/log/httpd/

安裝軟體

yum -y install httpd httpd-devel httpd-manual
yum -y install php-5 php-bcmath php-dba php-devel php-gd php-imap php-ldap php-mbstring php-mysql php-ncurses php-odbc php-pdo php-pear php-pgsql php-snmp php-soap php-xml php-xmlrpc mod_ssl

修改設定檔

vi /etc/httpd/conf/httpd.conf

ServerAdmin root@localhost

UserDir disable 修改--> #UserDir disable

#UserDir public_html 修改--> UserDir www

DirectoryIndex index.html index.html.var 修改--> DirectoryIndex index.html index.htm index.php index.html.var

LanguagePriority zh-TW en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN
AddDefaultCharset UTF-8 修改成--> #AddDefaultCharset UTF-8 或者 AddDefaultCharset none

service httpd restart

 

php

vi /etc/php.ini

max_execution_time = 300
default_charset = "utf8"
upload_max_filesize = 180M
post_max_size = 80M
register_globals = On
max_input_time = 600
memory_limit = 160M

vi /etc/httpd/conf.d/php.conf

DirectoryIndex index.php 修改 #DirectoryIndex index.php


測試php是否正常啟用

echo "<? phpinfo(); ?>" > /var/www/html/test.php

http://localhost/test.php

限某網域可讀取資料夾

vi /etc/httpd/conf/httpd.conf(格式如下)

<Directory /var/www/html/tool123456789>

Deny from all
Allow from IP
192.168.1.0/24
Options Indexes FollowSymLinks

</Directory>

<Directory /var/www/html/tools>

Deny from all
Allow from 163.32.X.0/24 192.168.1.0/24
Options Indexes FollowSymLinks

</Directory>

重新啟動httpd

service httpd restart

虛擬主機

<VirtualHost 163.32.x.x>

    ServerAdmin user@kh.edu.tw

    DocumentRoot /home/user

    ServerName user.kh.edu.tw

    ErrorLog /var/log/httpd/pedagogy/user-error_log

    CustomLog /var/log/httpd/pedagogy/user-access_log common

    DirectoryIndex index.php index.htm index.html default.htm

</VirtualHost>

伺服器更改預設字碼

伺服器更改為Big5(比較通用)

vi /etc/sysconfig/i18n

LANG="zh_TW.Big5"
SUPPORTED="zh_TW.Big5:zh_TW.UTF-8:zh_TW:zh:en_US.UTF-8:en_US:en"
SYSFONT="latarcyrheb-sun16"

 或下指令

export LANG=zh_TW.Big5

伺服器更改為UTF-8

vi /etc/sysconfig/i18n

LANG="zh_TW.UTF-8"
#LANG="zh_TW.Big5"
SUPPORTED="zh_TW.UTF-8:zh_TW.Big5:zh_TW:zh:en_US.UTF-8:en_US:en"
SYSFONT="latarcyrheb-sun16"

Don彙整筆記2010啟用