CentOS Linux release 7.3.1611 (Core)
# rpm -qa httpd
httpd-2.4.6-45.el7.centos.x86_64
編輯設定檔
# vi /etc/httpd/conf/httpd.conf
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
增加預設首頁
index.htm index.php
設定ServerName
ServerName www.XXX.XXX.edu.tw:80
語言設定加註解,讓網頁決定編碼
# AddDefaultCharset UTF-8
把 # AddDefaultCharset UTF-8 這行 MARK 起來,
也就是不要做任何設定,由網頁和瀏覽器來設定
重新啟動 Apache
# systemctl restart httpd
中文 URL 問題
- 安裝 httpd-devel (為了執行 apxs)
# yum -y install httpd-devel - 抓取 mod_fileiri
# wget http://dev.w3.org/apache-modules/mod_fileiri/mod_fileiri.c - 安裝
# apxs -i -a -c mod_fileiri.c
出現找不到 gcc 的問題 - 安裝 gcc
# yum -y install gcc - 重新安裝
# apxs -i -a -c mod_fileiri.c - 編輯 httpd.conf
# vi /etc/httpd/conf/httpd.conf
<IfModule mod_fileiri.c>
FileIRI On
FilenameCharset Big5
</IfModule> - 重新啟動 Apache# systemctl restart httpd
建立各處室網頁虛擬目錄
以前的寫法出現 403 錯誤
檢查資料夾和網頁權限都沒問題
Alias /principal /cnes/校長/www
<Location /principal>
Order deny,allow
Allow from all
</Location>
改用另一種寫法
# cat /etc/httpd/conf.d/jnes.conf
Alias /principal/ "/cnes/校長/www/"
<Directory "/cnes/校長/www/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /academic/ "/cnes/教務/www/"
<Directory "/cnes/教務/www/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /counselor/ "/cnes/輔導/www/"
<Directory "/cnes/輔導/www/">
Options FollowSymLinks
AllowOverride None
</Directory>
Alias /general/ "/cnes/總務/www/"
<Directory "/cnes/總務/www/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /physical/ "/cnes/訓導/www/"
<Directory "/cnes/訓導/www/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /computer/ "/cnes/資訊/www/"
<Directory "/cnes/資訊/www/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /personnel/ "/cnes/人事/www/"
<Directory "/cnes/人事/www/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /kindergarten/ "/cnes/幼兒園/www/"
<Directory "/cnes/幼兒園/www/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /parents/ "/cnes/家長會/www/"
<Directory "/cnes/家長會/www/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /course/ "/cnes/公用/課程計畫/"
<Directory "/cnes/公用/課程計畫/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
沒有留言:
張貼留言