XAMPP目錄結構
重要的文件和目錄
文件/目錄 用途
/opt/lampp/bin/ | XAMPP 命令庫。例如 /opt/lampp/bin/mysql 可執行 MySQL 監視器。 |
/opt/lampp/htdocs/ | Apache 文檔根目錄。 |
/opt/lampp/etc/httpd.conf | Apache 配制文件。 |
/opt/lampp/etc/my.cnf | MySQL 配制文件。 |
/opt/lampp/etc/php.ini | PHP 配制文件。 |
/opt/lampp/etc/proftpd.conf | ProFTPD 配制文件。(從 0.9.5 版開始) |
/opt/lampp/phpmyadmin/config.inc.php | phpMyAdmin 配制文件。 |
----------------------------------------------------------------------
阿里雲Linux環境下,進入后,在opt目錄上傳xampp安裝包: xampp-linux-x64-5.6.3-0-installer.run
上傳后可以在ftp工具中修改為755權限
Linux下XAMPP環境安裝
官方教程:https://www.apachefriends.org/faq_linux.html
安裝XAMPP
Choose your flavor for your linux OS, the 32-bit or 64-bit version.
Change the permissions to the installer
chmod 755 xampp-linux-*-installer.run
Run the installer
sudo ./xampp-linux-*-installer.run
That's all. XAMPP is now installed below the /opt/lampp directory.
啟動XAMPP:
To start XAMPP simply call this command:
sudo /opt/lampp/lampp start
You should now see something like this on your screen:
Starting XAMPP 1.8.2...
LAMPP: Starting Apache...
LAMPP: Starting MySQL...
LAMPP started.
Ready. Apache and MySQL are running.
If you get any error messages visit our community pages for help.
Also, note that there is a graphical tool that you can use to manage your servers easily. You can start this tool with the following commands:
cd /opt/lampp
sudo ./manager-linux.run (or manager-linux-x64.run)
停止XAMPP:
To stop XAMPP simply call this command:
sudo /opt/lampp/lampp stop
You should now see something like this on your screen:
Stopping XAMPP 1.8.2...
LAMPP: Stopping Apache...
LAMPP: Stopping MySQL...
LAMPP stopped.
If you get any error messages visit our community pages for help.
Also, note that there is a graphical tool that you can use to start/stop your servers easily. You can start this tool with the following commands:
cd /opt/lampp
sudo ./manager-linux.run (or manager-linux-x64.run)
------------------------------------------------------------
首先,請從www.xampp.org下載最新版XAMPP。然后,將安裝文件服知道/opt下並解壓。如果你計算機沒有/opt目錄,清用超級用戶身份執行mkdir/opt命令來創建目錄。如果計算機沒有sudo命令請用su命令並輸入超級用戶密碼來切換到超級用戶。
使用以下命令將文件復制到/opt:
$sudo cp xampp-linux-x.x.tar.gz /opt
使用一下命令進入opt/目錄並解壓縮文件:
$ cd /opt
$ sudo tar zxvf xampp-linux-x.x-x.tar.gz /opt
卸載 XAMPP,只需輸入如下命令:sudo rm -rf /opt/lampp
卸載完成。
如果想要普通用戶能寫htdocs目錄,清修改目錄權限。
$ sudo chmod -R a+rw /opt/lampp/htdocs
啟動或停止xampp:
$ sudo /opt/lampp/lampp start & stop
小技巧:
Linux下的XAMPP圖形化面板
$ cd /opt/lampp/share/xampp-control-panel
$ sudo ./xampp-control-panel
XAMPP 命令
安裝 XAMPP
tar xvfz xampp-linux-1.6.4.tar.gz -C /opt
啟動 XAMPP
/opt/lampp/lampp start
停止 XAMPP
/opt/lampp/lampp stop
重啟 XAMPP
/opt/lampp/lampp restart
安全設置
/opt/lampp/lampp security
使用php4
/opt/lampp/lampp php4
使用php5
/opt/lampp/lampp php5
查看php版本
/opt/lampp/lampp phpstatus
只啟動 Apache
/opt/lampp/lampp startapache
停止 Apache
/opt/lampp/lampp stopapache
啟動 Apache 的 SSL 支持
/opt/lampp/lampp startssl
停止 Apache 的 SSL 支持
/opt/lampp/lampp stopssl
只啟動 MySQL 數據庫
/opt/lampp/lampp startmysql
停止 MySQL 數據庫
/opt/lampp/lampp stopmysql
啟動 ProFTPD 服務
器
/opt/lampp/lampp startftp
停止 ProFTPD 服務器
/opt/lampp/lampp stopftp
隨系統自動啟動
ln -s /opt/lampp/lampp /etc/rc.d/rc3.d/S99lampp
ln -s /opt/lampp/lampp /etc/rc.d/rc4.d/S99lampp
ln -s /opt/lampp/lampp /etc/rc.d/rc5.d/S99lampp
取消隨系統自動運行
ln -s /opt/lampp/lampp K01lampp
卸載 XAMPP
rm -rf /opt/lampp
XAMPP 重要的文件和目錄
XAMPP 命令庫。例如 /opt/lampp/bin/mysql 可執行 MySQL 監視器
/opt/lampp/bin/
Apache 文檔根目錄
/opt/lampp/htdocs/
Apache 配置文件
/opt/lampp/etc/httpd.conf
MySQL 配置文件
/opt/lampp/etc/my.cnf
PHP 配制文件
/opt/lampp/etc/php.ini
ProFTPD 配制文件。(從 0.9.5 版開始)
/opt/lampp/etc/proftpd.conf
phpMyAdmin 配制文件
/opt/lampp/phpmyadmin/config.inc.php
xmapp 404設置
這樣做的好處一個是很友好,另一個是對於你的網站會更安全些,如果沒設置,別人在你的網址后隨便輸入一個路徑,會顯示404錯誤,並且會顯示你的服務器版本號,服務器配置一目了然,為了避免這種情況,可以設置錯誤頁面。
當出現404錯誤,即找不到網頁時,把訪問者導入到一個事先定義好的錯誤頁面。
修改 httpd.conf
找到:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 xxxxxxx
httpd.conf中的這一部分,#ErrorDocument 404 /missing.html 是顯示錯誤頁信息的,去掉前面的#
修改為 ErrorDocument 404 /error.htm,
其中error.htm為站點根目錄下和error目錄下的一個錯誤文件,需要你自己建立。當發生404錯誤時,進入error.htm頁面,可以提示網頁沒有找到。這樣就不可能看到你的服務器軟件信息了。也可以設置其它的錯誤導向的頁面,具體http響應錯誤編號請查閱相關資料。
重新啟動apache,如果沒意外,此時已經安裝成功,把靜態頁面放到站點根目錄和error目錄下,看能不能成功解析。隨便輸入一個:http://localhost/abcd.htm,看是不是導向你設置的404錯誤,即error.htm錯誤頁面.!
百度到這個方法,配置好重啟apache之后發現不行。。。
找了半天看到Include "conf/extra/httpd-multilang-errordoc.conf"這種類似的語句。
在conf/extra/httpd-multilang-errordoc.conf文件里面發現了
ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
ErrorDocument 404 /404error.html
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
ErrorDocument 410 /error/HTTP_GONE.html.var
ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
原來是被覆蓋掉了
在這里改掉之后重啟apache之后就OK了。。。。
我安裝的是xampp集成環境
今天有人問小編如何設置404頁面,小編就問他使用的什么web服務器,原來是使用的xampp集成環境,那不就等於為Apache配置一個404頁面,那還不簡單,於是乎打開Apache的配置文件,找到“#ErrorDocument 404 /missing.html”,去了#號,在網站根目錄下建立一個missing.html頁面,然后重啟Apache,本來期待成功后顯擺一下,沒想到意外的情況發生了,居然沒有生效,以前這么配置明明就可以了,為什么現在不行,改的配置文件不對?還是其他什么問題?經過一系列的測試,終於定位到了問題所在,原來在配置404的指令“#ErrorDocument 404 /missing.html”下面有這樣一段指令“Include conf/extra/httpd-multilang-errordoc.conf”,該指令引入httpd-multilang-errordoc.conf這個配置文件,看名稱好像是關於錯誤信息的文檔,是不是跟配置404不生效有關系?打開一看,除了404之外,還定義400,403,500等錯誤信息,八成就是因為這個配置文件的指令覆蓋了404配置所致,於是打開它定義的404文檔,果不其然,既然找到了原因,解決辦法就簡單很多了。
方法一:
使用#號注釋了Include conf/extra/httpd-multilang-errordoc.conf,使之無法生效,當然其他的錯誤信息的配置也無法生效了。
方法二:
把ErrorDocument 404 /missing.html指令書寫在Include conf/extra/httpd-multilang-errordoc.conf之后,這樣后書寫的指令會覆蓋前面的配置。
方法三:
使用.htaccess配置文件,在里面書寫ErrorDocument 404 /missing.html。需要開啟mod_rewrite組件。
雖然三種方法都能夠解決問題,但是前兩個方法均在Apache的配置文件中操作,影響了基於Apache提供服務的所有站點,第三種方法僅影響添加該配置文件的站點,至於選擇哪種方法,可以根據自身情況進行選擇。