XAMPP設定 - Apache
XAMPP目錄 C:\xampp 網站主目錄 Apache組態檔 php組態檔 phpMyAdmin MySQL C:\xampp\htdocs Apache組態檔 C:\xampp\apache\conf\httpd.conf php組態檔 C:\xampp\php\php.ini phpMyAdmin C:\xampp\phpMyAdmin\config.inc.php MySQL C:\xampp\mysql
httpd.conf 檔案位置: C:\xampp\apache\conf # This is the main Apache HTTP … ServerRoot "C:/xampp/apache" Listen 80 DocumentRoot "C:/xampp/htdocs" LoadModule alias_module modules/mod_alias.so <IfModule alias_module> … </IfModule>
Directory 預設目錄設定 <Directory /> AllowOverride none Require all denied </Directory>
網站主目錄設定 <Directory "C:/xampp/htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Directory>
Directory Browsing Options Indexes
Disable Directory Browsing Options -Indexes
AllowOverride 除了httpd.conf組態設定,也可於每個資料夾 下的.htaccess檔案設定 Example: AllowOverride All AllowOverride None AllowOverride Indexes AuthConfig
.htaccess Example Options Indexes AuthType Basic AuthName "YCChen's Restricted Files" AuthUserFile C:/xampp/.htpasswd Require user ycchen http://httpd.apache.org/docs/2.0/howto/auth.html
使用htpasswd產生密碼檔 C:\xampp\apache\bin htpasswd –c 路徑/密碼檔名 使用者名稱 htpasswd –c C:\xampp\.htpasswd ycchen
Alias (別名) <IfModule alias_module> # 設定資料夾別名 Alias /php "D:/course/www/php" #設定網址別名 Alias /class "D:/course/www/php/class/data.php" </IfModule> http://localhost/php/hw.php http://localhost/php/ex1/ http://localhost/class
為有設別名之資料夾設定組態 <Directory "D:/course/www/php"> AllowOverride None Options –Indexes FollowSymLinks Order allow,deny Allow from all #AuthType Basic #AuthName "Admin Only" #AuthUserFile C:/xampp/.htpasswd #Require user ycchen admin </Directory>
其他設定 <IfModule dir_module> DirectoryIndex index.php index.pl index.html … </IfModule> Include "conf/extra/httpd-xampp.conf" # 注意一些組態設定在C:\xampp\apache\conf\extra <Files private.html> Order allow,deny Deny from all </Files>