天天看點

***linux下安裝xampp,XAMPP目錄結構(阿裡雲安裝xampp)xmapp 404設定

重要的檔案和目錄

檔案/目錄                              用途

/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,XAMPP目錄結構(阿裡雲安裝xampp)xmapp 404設定

官方教程: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.

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

Stopping XAMPP 1.8.2...

LAMPP: Stopping Apache...

LAMPP: Stopping MySQL...

LAMPP stopped.

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:

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

首先,請從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 螢幕

Apache 文檔根目錄

Apache 配置檔案

MySQL 配置檔案

PHP 配制檔案

phpMyAdmin 配制檔案

這樣做的好處一個是很友好,另一個是對于你的網站會更安全些,如果沒設定,别人在你的網址後随便輸入一個路徑,會顯示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內建環境

<a href="http://blog.csdn.net/a7442358/article/details/49514529">xampp內建環境自定義404頁面失敗解決辦法</a>

    今天有人問小編如何設定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提供服務的所有站點,第三種方法僅影響添加該配置檔案的站點,至于選擇哪種方法,可以根據自身情況進行選擇。

如何聯系我:【萬裡虎】www.bravetiger.cn

【QQ】3396726884 (咨詢問題100元起,幫助解決問題500元起)

【部落格】http://www.cnblogs.com/kenshinobiy/