在ubunt中裝apache

來源:互聯網
上載者:User

1. 安裝

安裝apache

apt-get install apache2

安裝php

apt-get install libapache2-mod-php5

apt-get install php5

安裝mysql

apt-get install mysql-server

apt-get install libapache2-mod-auth-mysql

apt-get install php5-mysql

重啟apache

apache2ctl restart

apache2ctl stop

2. 配置

預設的設定檔在

/etc/apache2/apache2.conf

在設定檔的最後有

Include sites-enabled/

表示又include了別的檔案。

這個目錄下有  000-default , 這個檔案指明了virtualhost的配置。 

比如 DocumentRoot /var/www   表示根在 /var/www下面。

3. 測試php

vi /var/www/phpinfo.php

<?php phpinfo() ?>

然後用瀏覽器開啟 http://localhost/phpinfo.php

如果有顯示php的資訊,greate。

4. 改變連接埠號碼

vi /etc/apache2/ports.conf

Listen 80 改成

Listen 8080

vi  /etc/apache2/sites-enabled/000-default

<VirtualHost *:80>

改成

<VirtualHost *:8080>

參考文檔

http://wiki.ubuntu.org.cn/Apache

http://hi.baidu.com/thinkzero/blog/item/0af81782acc41edc9023d9f5.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.